Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(906)

Unified Diff: ui/gfx/skbitmap_operations.cc

Issue 361643002: setConfig is deprecated, use setInfo or allocPixels instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't call allocPixels+rowbytes yet (skia bug) Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/image/image_util_unittest.cc ('k') | ui/gfx/skbitmap_operations_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skbitmap_operations.cc
diff --git a/ui/gfx/skbitmap_operations.cc b/ui/gfx/skbitmap_operations.cc
index d3b48271bbe41e6c553d3b7a6194ce1d0b256537..c2d26612991e7681921e58e08622f770a11b4891 100644
--- a/ui/gfx/skbitmap_operations.cc
+++ b/ui/gfx/skbitmap_operations.cc
@@ -21,7 +21,7 @@
// static
SkBitmap SkBitmapOperations::CreateInvertedBitmap(const SkBitmap& image) {
- DCHECK(image.colorType() == kPMColor_SkColorType);
+ DCHECK(image.colorType() == kN32_SkColorType);
SkAutoLockPixels lock_image(image);
@@ -49,7 +49,7 @@ SkBitmap SkBitmapOperations::CreateSuperimposedBitmap(const SkBitmap& first,
DCHECK(first.width() == second.width());
DCHECK(first.height() == second.height());
DCHECK(first.bytesPerPixel() == second.bytesPerPixel());
- DCHECK(first.colorType() == kPMColor_SkColorType);
+ DCHECK(first.colorType() == kN32_SkColorType);
SkAutoLockPixels lock_first(first);
SkAutoLockPixels lock_second(second);
@@ -80,7 +80,7 @@ SkBitmap SkBitmapOperations::CreateBlendedBitmap(const SkBitmap& first,
DCHECK(first.width() == second.width());
DCHECK(first.height() == second.height());
DCHECK(first.bytesPerPixel() == second.bytesPerPixel());
- DCHECK(first.colorType() == kPMColor_SkColorType);
+ DCHECK(first.colorType() == kN32_SkColorType);
// Optimize for case where we won't need to blend anything.
static const double alpha_min = 1.0 / 255;
@@ -130,8 +130,8 @@ SkBitmap SkBitmapOperations::CreateMaskedBitmap(const SkBitmap& rgb,
DCHECK(rgb.width() == alpha.width());
DCHECK(rgb.height() == alpha.height());
DCHECK(rgb.bytesPerPixel() == alpha.bytesPerPixel());
- DCHECK(rgb.colorType() == kPMColor_SkColorType);
- DCHECK(alpha.colorType() == kPMColor_SkColorType);
+ DCHECK(rgb.colorType() == kN32_SkColorType);
+ DCHECK(alpha.colorType() == kN32_SkColorType);
SkBitmap masked;
masked.allocN32Pixels(rgb.width(), rgb.height());
@@ -167,8 +167,8 @@ SkBitmap SkBitmapOperations::CreateMaskedBitmap(const SkBitmap& rgb,
SkBitmap SkBitmapOperations::CreateButtonBackground(SkColor color,
const SkBitmap& image,
const SkBitmap& mask) {
- DCHECK(image.colorType() == kPMColor_SkColorType);
- DCHECK(mask.colorType() == kPMColor_SkColorType);
+ DCHECK(image.colorType() == kN32_SkColorType);
+ DCHECK(mask.colorType() == kN32_SkColorType);
SkBitmap background;
background.allocN32Pixels(mask.width(), mask.height());
@@ -547,7 +547,7 @@ SkBitmap SkBitmapOperations::CreateHSLShiftedBitmap(
HSLShift::kLineProcessors[H_op][S_op][L_op];
DCHECK(bitmap.empty() == false);
- DCHECK(bitmap.colorType() == kPMColor_SkColorType);
+ DCHECK(bitmap.colorType() == kN32_SkColorType);
SkBitmap shifted;
shifted.allocN32Pixels(bitmap.width(), bitmap.height());
@@ -571,7 +571,7 @@ SkBitmap SkBitmapOperations::CreateHSLShiftedBitmap(
SkBitmap SkBitmapOperations::CreateTiledBitmap(const SkBitmap& source,
int src_x, int src_y,
int dst_w, int dst_h) {
- DCHECK(source.colorType() == kPMColor_SkColorType);
+ DCHECK(source.colorType() == kN32_SkColorType);
SkBitmap cropped;
cropped.allocN32Pixels(dst_w, dst_h);
@@ -711,7 +711,7 @@ SkBitmap SkBitmapOperations::UnPreMultiply(const SkBitmap& bitmap) {
// static
SkBitmap SkBitmapOperations::CreateTransposedBitmap(const SkBitmap& image) {
- DCHECK(image.colorType() == kPMColor_SkColorType);
+ DCHECK(image.colorType() == kN32_SkColorType);
SkBitmap transposed;
transposed.allocN32Pixels(image.height(), image.width());
@@ -733,7 +733,7 @@ SkBitmap SkBitmapOperations::CreateTransposedBitmap(const SkBitmap& image) {
// static
SkBitmap SkBitmapOperations::CreateColorMask(const SkBitmap& bitmap,
SkColor c) {
- DCHECK(bitmap.colorType() == kPMColor_SkColorType);
+ DCHECK(bitmap.colorType() == kN32_SkColorType);
SkBitmap color_mask;
color_mask.allocN32Pixels(bitmap.width(), bitmap.height());
@@ -753,7 +753,7 @@ SkBitmap SkBitmapOperations::CreateColorMask(const SkBitmap& bitmap,
SkBitmap SkBitmapOperations::CreateDropShadow(
const SkBitmap& bitmap,
const gfx::ShadowValues& shadows) {
- DCHECK(bitmap.colorType() == kPMColor_SkColorType);
+ DCHECK(bitmap.colorType() == kN32_SkColorType);
// Shadow margin insets are negative values because they grow outside.
// Negate them here as grow direction is not important and only pixel value
@@ -800,21 +800,18 @@ SkBitmap SkBitmapOperations::Rotate(const SkBitmap& source,
switch (rotation) {
case ROTATION_90_CW:
angle = SkFloatToScalar(90.0f);
- result.setConfig(
- SkBitmap::kARGB_8888_Config, source.height(), source.width());
+ result.allocN32Pixels(source.height(), source.width());
break;
case ROTATION_180_CW:
angle = SkFloatToScalar(180.0f);
- result.setConfig(
- SkBitmap::kARGB_8888_Config, source.width(), source.height());
+ result.allocN32Pixels(source.width(), source.height());
break;
case ROTATION_270_CW:
angle = SkFloatToScalar(270.0f);
- result.setConfig(
- SkBitmap::kARGB_8888_Config, source.height(), source.width());
+ result.allocN32Pixels(source.height(), source.width());
break;
}
- result.allocPixels();
+
SkCanvas canvas(result);
canvas.clear(SkColorSetARGB(0, 0, 0, 0));
« no previous file with comments | « ui/gfx/image/image_util_unittest.cc ('k') | ui/gfx/skbitmap_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698