Delete chrome_pdf::CreateN32PremulSkBitmap()
Inlines CreateN32PremulSkBitmap(), allowing the removal of the bitmap.cc
and bitmap.h files in //pdf/ppapi_migration.
Bug: 1302059
Change-Id: I4fa068bdbe031507b070f7f9e27e3ffc39944f5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3615580
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#997950}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
570c515e74
commit
a23c119fa0
10
pdf/BUILD.gn
10
pdf/BUILD.gn
@ -240,8 +240,6 @@ if (enable_pdf) {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
sources = [
|
||||
"ppapi_migration/bitmap.cc",
|
||||
"ppapi_migration/bitmap.h",
|
||||
"ppapi_migration/result_codes.h",
|
||||
"ppapi_migration/url_loader.cc",
|
||||
"ppapi_migration/url_loader.h",
|
||||
@ -251,13 +249,9 @@ if (enable_pdf) {
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//printing/mojom",
|
||||
"//skia",
|
||||
"//net",
|
||||
"//third_party/blink/public:blink",
|
||||
"//third_party/blink/public/common:headers",
|
||||
"//ui/base",
|
||||
"//ui/base/cursor/mojom:cursor_type",
|
||||
"//ui/gfx",
|
||||
"//url",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "third_party/blink/public/web/web_print_preset_options.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "third_party/skia/include/core/SkImageInfo.h"
|
||||
#include "ui/events/blink/blink_event_util.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
#include "ui/gfx/geometry/point_conversions.h"
|
||||
@ -843,7 +844,8 @@ void PdfViewPluginBase::UpdateGeometryOnPluginRectChanged(
|
||||
const gfx::Size new_image_size =
|
||||
PaintManager::GetNewContextSize(old_image_size, plugin_rect_.size());
|
||||
if (new_image_size != old_image_size) {
|
||||
InitImageData(new_image_size);
|
||||
image_data_.allocPixels(
|
||||
SkImageInfo::MakeN32Premul(gfx::SizeToSkISize(new_image_size)));
|
||||
first_paint_ = true;
|
||||
}
|
||||
|
||||
|
@ -252,9 +252,6 @@ class PdfViewPluginBase : public PDFEngine::Client,
|
||||
// Send a notification that the print preview has loaded.
|
||||
void SendPrintPreviewLoadedNotification();
|
||||
|
||||
// Initialize image buffer(s) according to the new context size.
|
||||
virtual void InitImageData(const gfx::Size& size) = 0;
|
||||
|
||||
// Schedules invalidation tasks after painting finishes.
|
||||
void InvalidateAfterPaintDone();
|
||||
|
||||
@ -378,8 +375,6 @@ class PdfViewPluginBase : public PDFEngine::Client,
|
||||
|
||||
bool full_frame() const { return full_frame_; }
|
||||
|
||||
SkBitmap& mutable_image_data() { return image_data_; }
|
||||
|
||||
const gfx::Rect& available_area() const { return available_area_; }
|
||||
|
||||
void set_document_size(const gfx::Size& size) { document_size_ = size; }
|
||||
|
@ -149,8 +149,6 @@ class FakePdfViewPluginBase : public PdfViewPluginBase {
|
||||
|
||||
MOCK_METHOD(void, SaveAs, (), (override));
|
||||
|
||||
MOCK_METHOD(void, InitImageData, (const gfx::Size&), (override));
|
||||
|
||||
MOCK_METHOD(void, SetFormTextFieldInFocus, (bool), (override));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "pdf/pdfium/pdfium_engine.h"
|
||||
#include "pdf/post_message_receiver.h"
|
||||
#include "pdf/post_message_sender.h"
|
||||
#include "pdf/ppapi_migration/bitmap.h"
|
||||
#include "pdf/ppapi_migration/result_codes.h"
|
||||
#include "pdf/ppapi_migration/url_loader.h"
|
||||
#include "pdf/ui/document_properties.h"
|
||||
@ -946,10 +945,6 @@ void PdfViewWebPlugin::SaveAs() {
|
||||
network::mojom::ReferrerPolicy::kDefault);
|
||||
}
|
||||
|
||||
void PdfViewWebPlugin::InitImageData(const gfx::Size& size) {
|
||||
mutable_image_data() = CreateN32PremulSkBitmap(gfx::SizeToSkISize(size));
|
||||
}
|
||||
|
||||
void PdfViewWebPlugin::SetFormTextFieldInFocus(bool in_focus) {
|
||||
text_input_type_ = in_focus ? blink::WebTextInputType::kWebTextInputTypeText
|
||||
: blink::WebTextInputType::kWebTextInputTypeNone;
|
||||
|
@ -298,7 +298,6 @@ class PdfViewWebPlugin final : public PdfViewPluginBase,
|
||||
void OnDocumentLoadComplete() override;
|
||||
void SendMessage(base::Value::Dict message) override;
|
||||
void SaveAs() override;
|
||||
void InitImageData(const gfx::Size& size) override;
|
||||
void SetFormTextFieldInFocus(bool in_focus) override;
|
||||
void SetAccessibilityDocInfo(AccessibilityDocInfo doc_info) override;
|
||||
void SetAccessibilityPageInfo(AccessibilityPageInfo page_info,
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "cc/paint/paint_canvas.h"
|
||||
#include "cc/test/pixel_comparator.h"
|
||||
#include "cc/test/pixel_test_utils.h"
|
||||
#include "pdf/ppapi_migration/bitmap.h"
|
||||
#include "pdf/test/test_helpers.h"
|
||||
#include "pdf/test/test_pdfium_engine.h"
|
||||
#include "testing/gmock/include/gmock/gmock-matchers.h"
|
||||
@ -120,8 +119,7 @@ MATCHER_P(IsExpectedImeKeyEvent, expected_text, "") {
|
||||
SkBitmap GenerateExpectedBitmapForPaint(const gfx::Rect& expected_clipped_rect,
|
||||
SkColor paint_color) {
|
||||
SkBitmap expected_bitmap =
|
||||
CreateN32PremulSkBitmap(gfx::SizeToSkISize(kCanvasSize));
|
||||
expected_bitmap.eraseColor(kDefaultColor);
|
||||
CreateSkiaImageForTesting(kCanvasSize, kDefaultColor);
|
||||
expected_bitmap.erase(paint_color, gfx::RectToSkIRect(expected_clipped_rect));
|
||||
return expected_bitmap;
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "pdf/ppapi_migration/bitmap.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkImageInfo.h"
|
||||
#include "third_party/skia/include/core/SkSize.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
SkBitmap CreateN32PremulSkBitmap(const SkISize& size) {
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32Premul(size));
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
} // namespace chrome_pdf
|
@ -1,19 +0,0 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef PDF_PPAPI_MIGRATION_BITMAP_H_
|
||||
#define PDF_PPAPI_MIGRATION_BITMAP_H_
|
||||
|
||||
#include "third_party/skia/include/core/SkSize.h"
|
||||
|
||||
class SkBitmap;
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
// Creates an SkBitmap of a given `size`.
|
||||
SkBitmap CreateN32PremulSkBitmap(const SkISize& size);
|
||||
|
||||
} // namespace chrome_pdf
|
||||
|
||||
#endif // PDF_PPAPI_MIGRATION_BITMAP_H_
|
@ -9,7 +9,6 @@
|
||||
#include "base/path_service.h"
|
||||
#include "cc/test/pixel_comparator.h"
|
||||
#include "cc/test/pixel_test_utils.h"
|
||||
#include "pdf/ppapi_migration/bitmap.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
@ -45,7 +44,8 @@ testing::AssertionResult MatchesPngFile(
|
||||
}
|
||||
|
||||
SkBitmap CreateSkiaImageForTesting(const gfx::Size& size, SkColor color) {
|
||||
SkBitmap bitmap = CreateN32PremulSkBitmap(gfx::SizeToSkISize(size));
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32Premul(gfx::SizeToSkISize(size)));
|
||||
bitmap.eraseColor(color);
|
||||
return bitmap;
|
||||
}
|
||||
|
Reference in New Issue
Block a user