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

Unified Diff: ui/gfx/codec/png_codec.cc

Issue 10316019: Aura: Adds custom cursors for drag and drop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 8 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
Index: ui/gfx/codec/png_codec.cc
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc
index 1ca139d1ceaf3163cda2432687ccd2470ba6d0a9..da73928384aefed3a54abce0c64ef6543748afe2 100644
--- a/ui/gfx/codec/png_codec.cc
+++ b/ui/gfx/codec/png_codec.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
#include "ui/gfx/size.h"
+#include "ui/gfx/skia_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"
#include "third_party/skia/include/core/SkColorPriv.h"
@@ -76,25 +77,7 @@ void ConvertSkiatoRGB(const unsigned char* skia, int pixel_width,
void ConvertSkiatoRGBA(const unsigned char* skia, int pixel_width,
unsigned char* rgba, bool* is_opaque) {
- int total_length = pixel_width * 4;
- for (int i = 0; i < total_length; i += 4) {
- const uint32_t pixel_in = *reinterpret_cast<const uint32_t*>(&skia[i]);
-
- // Pack the components here.
- int alpha = SkGetPackedA32(pixel_in);
- if (alpha != 0 && alpha != 255) {
- SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel_in);
- rgba[i + 0] = SkColorGetR(unmultiplied);
- rgba[i + 1] = SkColorGetG(unmultiplied);
- rgba[i + 2] = SkColorGetB(unmultiplied);
- rgba[i + 3] = alpha;
- } else {
- rgba[i + 0] = SkGetPackedR32(pixel_in);
- rgba[i + 1] = SkGetPackedG32(pixel_in);
- rgba[i + 2] = SkGetPackedB32(pixel_in);
- rgba[i + 3] = alpha;
- }
- }
+ gfx::ConvertSkiaToRGBA(skia, pixel_width, rgba);
}
} // namespace
« content/test/DEPS ('K') | « ui/base/x/x11_util.cc ('k') | ui/gfx/skia_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698