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

Unified Diff: gm/gammatext.cpp

Issue 163823002: Revert of add peekPixels to SkCanvas and SkSurface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « gm/displacement.cpp ('k') | gm/gm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gammatext.cpp
diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp
index 7ee55db2fb61677882fe6f7b073ed44eec29905f..99642f6e3e13cd4a16eb6820dbfb1b28f0e173c4 100644
--- a/gm/gammatext.cpp
+++ b/gm/gammatext.cpp
@@ -38,14 +38,14 @@
#import <ApplicationServices/ApplicationServices.h>
#define BITMAP_INFO_RGB (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host)
-static CGContextRef makeCG(const SkImageInfo& info, const void* addr,
- size_t rowBytes) {
- if (kPMColor_SkColorType != info.colorType() || NULL == addr) {
+static CGContextRef makeCG(const SkBitmap& bm) {
+ if (SkBitmap::kARGB_8888_Config != bm.config() ||
+ NULL == bm.getPixels()) {
return NULL;
}
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
- CGContextRef cg = CGBitmapContextCreate((void*)addr, info.width(), info.height(),
- 8, rowBytes, space, BITMAP_INFO_RGB);
+ CGContextRef cg = CGBitmapContextCreate(bm.getPixels(), bm.width(), bm.height(),
+ 8, bm.rowBytes(), space, BITMAP_INFO_RGB);
CFRelease(space);
CGContextSetAllowsFontSubpixelQuantization(cg, false);
@@ -143,15 +143,7 @@
virtual void onDraw(SkCanvas* canvas) {
#ifdef SK_BUILD_FOR_MAC
- CGContextRef cg = 0;
- {
- SkImageInfo info;
- size_t rowBytes;
- const void* addr = canvas->peekPixels(&info, &rowBytes);
- if (addr) {
- cg = makeCG(info, addr, rowBytes);
- }
- }
+ CGContextRef cg = makeCG(canvas->getDevice()->accessBitmap(false));
#endif
drawGrad(canvas);
« no previous file with comments | « gm/displacement.cpp ('k') | gm/gm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698