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

Side by Side Diff: src/utils/SkPictureUtils.cpp

Issue 199413013: add new readPixels with direct memory parameters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 const uint16_t indices[], int indexCount, 150 const uint16_t indices[], int indexCount,
151 const SkPaint& paint) SK_OVERRIDE { 151 const SkPaint& paint) SK_OVERRIDE {
152 this->addBitmapFromPaint(paint); 152 this->addBitmapFromPaint(paint);
153 } 153 }
154 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, 154 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
155 const SkPaint&) SK_OVERRIDE { 155 const SkPaint&) SK_OVERRIDE {
156 nothing_to_do(); 156 nothing_to_do();
157 } 157 }
158 158
159 protected: 159 protected:
160 virtual bool onReadPixels(const SkBitmap& bitmap,
161 int x, int y,
162 SkCanvas::Config8888 config8888) SK_OVERRIDE {
163 not_supported();
164 return false;
165 }
166
167 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI DE { 160 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI DE {
168 not_supported(); 161 not_supported();
169 } 162 }
170 virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) S K_OVERRIDE { 163 virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) S K_OVERRIDE {
171 // we expect to only get called via savelayer, in which case it is fine. 164 // we expect to only get called via savelayer, in which case it is fine.
172 SkASSERT(kSaveLayer_Usage == usage); 165 SkASSERT(kSaveLayer_Usage == usage);
173 return SkNEW_ARGS(GatherPixelRefDevice, (info.width(), info.height(), fP RSet)); 166 return SkNEW_ARGS(GatherPixelRefDevice, (info.width(), info.height(), fP RSet));
174 } 167 }
175 virtual void flush() SK_OVERRIDE {} 168 virtual void flush() SK_OVERRIDE {}
176 169
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 canvas.clipRect(area, SkRegion::kIntersect_Op, false); 214 canvas.clipRect(area, SkRegion::kIntersect_Op, false);
222 canvas.drawPicture(*pict); 215 canvas.drawPicture(*pict);
223 216
224 SkData* data = NULL; 217 SkData* data = NULL;
225 int count = array.count(); 218 int count = array.count();
226 if (count > 0) { 219 if (count > 0) {
227 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*) ); 220 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*) );
228 } 221 }
229 return data; 222 return data;
230 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698