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

Side by Side Diff: src/core/SkDevice.cpp

Issue 159723006: add peekPixels to canvas (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkDevice.h" 8 #include "SkDevice.h"
9 #include "SkMetaData.h" 9 #include "SkMetaData.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 SkMetaData& SkBaseDevice::getMetaData() { 59 SkMetaData& SkBaseDevice::getMetaData() {
60 // metadata users are rare, so we lazily allocate it. If that changes we 60 // metadata users are rare, so we lazily allocate it. If that changes we
61 // can decide to just make it a field in the device (rather than a ptr) 61 // can decide to just make it a field in the device (rather than a ptr)
62 if (NULL == fMetaData) { 62 if (NULL == fMetaData) {
63 fMetaData = new SkMetaData; 63 fMetaData = new SkMetaData;
64 } 64 }
65 return *fMetaData; 65 return *fMetaData;
66 } 66 }
67 67
68 // TODO: when we can remove width/height/config from SkBaseDevice, then other
69 // classes should explicitly override this guy.
70 SkImageInfo SkBaseDevice::imageInfo() const {
71 return SkImageInfo::Make(this->width(),
72 this->height(),
73 SkBitmapConfigToColorType(this->config()),
74 this->isOpaque() ? kOpaque_SkAlphaType :
75 kPremul_SkAlphaType);
76 }
77
68 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { 78 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
69 const SkBitmap& bitmap = this->onAccessBitmap(); 79 const SkBitmap& bitmap = this->onAccessBitmap();
70 if (changePixels) { 80 if (changePixels) {
71 bitmap.notifyPixelsChanged(); 81 bitmap.notifyPixelsChanged();
72 } 82 }
73 return bitmap; 83 return bitmap;
74 } 84 }
75 85
76 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, 86 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y,
77 SkCanvas::Config8888 config8888) { 87 SkCanvas::Config8888 config8888) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 srcRect.fLeft, 120 srcRect.fLeft,
111 srcRect.fTop, 121 srcRect.fTop,
112 config8888); 122 config8888);
113 if (result && bmp == &tmp) { 123 if (result && bmp == &tmp) {
114 tmp.swap(*bitmap); 124 tmp.swap(*bitmap);
115 } 125 }
116 return result; 126 return result;
117 } 127 }
118 128
119 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } 129 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; }
130
131 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698