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

Unified Diff: ui/gfx/skbitmap_operations.cc

Issue 394183002: ui/gfx: remove redundant erase operations and remove unused function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/skbitmap_operations.h ('k') | no next file » | 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 c2d26612991e7681921e58e08622f770a11b4891..d1f255e574588cd34ef9e649afa2dbe28415ea1f 100644
--- a/ui/gfx/skbitmap_operations.cc
+++ b/ui/gfx/skbitmap_operations.cc
@@ -27,7 +27,6 @@ SkBitmap SkBitmapOperations::CreateInvertedBitmap(const SkBitmap& image) {
SkBitmap inverted;
inverted.allocN32Pixels(image.width(), image.height());
danakj 2014/07/16 15:18:25 will it be filled with opaque values? you can save
hyunki 2014/07/16 15:28:48 Yes. I think so. Please check below codes to fill
danakj 2014/07/16 15:30:42 It depends on the input image right?
hyunki 2014/07/16 15:35:16 Yes. It depends on the input image. All alphas for
danakj 2014/07/16 15:38:11 So, do you want to tell allocN32 if it will be opa
hyunki 2014/07/16 15:42:17 No. I'm telling below operation fills whole alloce
danakj 2014/07/16 15:52:29 So then how about passing true for opaque to alloc
hyunki 2014/07/16 16:03:03 Sorry. For clarification, (your question) will it
- inverted.eraseARGB(0, 0, 0, 0);
for (int y = 0; y < image.height(); ++y) {
uint32* image_row = image.getAddr32(0, y);
@@ -44,35 +43,6 @@ SkBitmap SkBitmapOperations::CreateInvertedBitmap(const SkBitmap& image) {
}
// static
-SkBitmap SkBitmapOperations::CreateSuperimposedBitmap(const SkBitmap& first,
- const SkBitmap& second) {
- DCHECK(first.width() == second.width());
- DCHECK(first.height() == second.height());
- DCHECK(first.bytesPerPixel() == second.bytesPerPixel());
- DCHECK(first.colorType() == kN32_SkColorType);
-
- SkAutoLockPixels lock_first(first);
- SkAutoLockPixels lock_second(second);
-
- SkBitmap superimposed;
- superimposed.allocN32Pixels(first.width(), first.height());
- superimposed.eraseARGB(0, 0, 0, 0);
-
- SkCanvas canvas(superimposed);
-
- SkRect rect;
- rect.fLeft = 0;
- rect.fTop = 0;
- rect.fRight = SkIntToScalar(first.width());
- rect.fBottom = SkIntToScalar(first.height());
-
- canvas.drawBitmapRect(first, NULL, rect);
- canvas.drawBitmapRect(second, NULL, rect);
-
- return superimposed;
-}
-
-// static
SkBitmap SkBitmapOperations::CreateBlendedBitmap(const SkBitmap& first,
const SkBitmap& second,
double alpha) {
@@ -95,7 +65,6 @@ SkBitmap SkBitmapOperations::CreateBlendedBitmap(const SkBitmap& first,
SkBitmap blended;
blended.allocN32Pixels(first.width(), first.height());
- blended.eraseARGB(0, 0, 0, 0);
danakj 2014/07/16 15:18:25 ditto for the rest
hyunki 2014/07/16 15:28:48 ditto. dst_row[x] = SkColorSetARGB(a, r, g, b);
double first_alpha = 1 - alpha;
@@ -135,7 +104,6 @@ SkBitmap SkBitmapOperations::CreateMaskedBitmap(const SkBitmap& rgb,
SkBitmap masked;
masked.allocN32Pixels(rgb.width(), rgb.height());
- masked.eraseARGB(0, 0, 0, 0);
SkAutoLockPixels lock_rgb(rgb);
SkAutoLockPixels lock_alpha(alpha);
@@ -551,7 +519,6 @@ SkBitmap SkBitmapOperations::CreateHSLShiftedBitmap(
SkBitmap shifted;
shifted.allocN32Pixels(bitmap.width(), bitmap.height());
- shifted.eraseARGB(0, 0, 0, 0);
SkAutoLockPixels lock_bitmap(bitmap);
SkAutoLockPixels lock_shifted(shifted);
@@ -575,7 +542,6 @@ SkBitmap SkBitmapOperations::CreateTiledBitmap(const SkBitmap& source,
SkBitmap cropped;
cropped.allocN32Pixels(dst_w, dst_h);
- cropped.eraseARGB(0, 0, 0, 0);
SkAutoLockPixels lock_source(source);
SkAutoLockPixels lock_cropped(cropped);
« no previous file with comments | « ui/gfx/skbitmap_operations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698