Commit 474531a1 authored by Wei Li's avatar Wei Li Committed by Commit Bot

[color] Replace a few image SK_Color constants

These image colors are either used as placeholder background colors or
error colors. We can safely replace them with kPlaceholderColor.

BUG=1059867

Change-Id: Ie4485eb333dae5d52a238eeeb8e9cf6c6391553c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134625Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756110}
parent fb6c9b63
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "third_party/skia/include/core/SkClipOp.h" #include "third_party/skia/include/core/SkClipOp.h"
#include "third_party/skia/include/core/SkDrawLooper.h" #include "third_party/skia/include/core/SkDrawLooper.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h" #include "ui/gfx/geometry/point_conversions.h"
...@@ -47,7 +48,7 @@ gfx::Rect DIPToPixelBounds(gfx::Rect dip_bounds, float scale) { ...@@ -47,7 +48,7 @@ gfx::Rect DIPToPixelBounds(gfx::Rect dip_bounds, float scale) {
ImageSkiaRep GetErrorImageRep(float scale, const gfx::Size& pixel_size) { ImageSkiaRep GetErrorImageRep(float scale, const gfx::Size& pixel_size) {
SkBitmap bitmap; SkBitmap bitmap;
bitmap.allocN32Pixels(pixel_size.width(), pixel_size.height()); bitmap.allocN32Pixels(pixel_size.width(), pixel_size.height());
bitmap.eraseColor(SK_ColorRED); bitmap.eraseColor(kPlaceholderColor);
return gfx::ImageSkiaRep(bitmap, scale); return gfx::ImageSkiaRep(bitmap, scale);
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "cc/paint/record_paint_canvas.h" #include "cc/paint/record_paint_canvas.h"
#include "cc/paint/skia_paint_canvas.h" #include "cc/paint/skia_paint_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/color_palette.h"
namespace gfx { namespace gfx {
...@@ -19,7 +20,7 @@ ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) ...@@ -19,7 +20,7 @@ ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale)
: type_(ImageRepType::kImageTypeBitmap), scale_(scale) { : type_(ImageRepType::kImageTypeBitmap), scale_(scale) {
bitmap_.allocN32Pixels(static_cast<int>(size.width() * this->scale()), bitmap_.allocN32Pixels(static_cast<int>(size.width() * this->scale()),
static_cast<int>(size.height() * this->scale())); static_cast<int>(size.height() * this->scale()));
bitmap_.eraseColor(SK_ColorRED); bitmap_.eraseColor(kPlaceholderColor);
bitmap_.setImmutable(); bitmap_.setImmutable();
pixel_size_.SetSize(bitmap_.width(), bitmap_.height()); pixel_size_.SetSize(bitmap_.width(), bitmap_.height());
paint_image_ = cc::PaintImage::CreateFromBitmap(bitmap_); paint_image_ = cc::PaintImage::CreateFromBitmap(bitmap_);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ui/gfx/image/image_skia_rep_ios.h" #include "ui/gfx/image/image_skia_rep_ios.h"
#include "base/logging.h" #include "base/logging.h"
#include "ui/gfx/color_palette.h"
namespace gfx { namespace gfx {
...@@ -13,7 +14,7 @@ ImageSkiaRep::ImageSkiaRep() : scale_(0.0f) {} ...@@ -13,7 +14,7 @@ ImageSkiaRep::ImageSkiaRep() : scale_(0.0f) {}
ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) { ImageSkiaRep::ImageSkiaRep(const gfx::Size& size, float scale) : scale_(scale) {
bitmap_.allocN32Pixels(static_cast<int>(size.width() * this->scale()), bitmap_.allocN32Pixels(static_cast<int>(size.width() * this->scale()),
static_cast<int>(size.height() * this->scale())); static_cast<int>(size.height() * this->scale()));
bitmap_.eraseColor(SK_ColorRED); bitmap_.eraseColor(kPlaceholderColor);
bitmap_.setImmutable(); bitmap_.setImmutable();
pixel_size_.SetSize(bitmap_.width(), bitmap_.height()); pixel_size_.SetSize(bitmap_.width(), bitmap_.height());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment