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

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

Issue 211043002: remove all references to legacy Config8888 (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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/device/xps/SkXPSDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { 97 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
98 const SkBitmap& bitmap = this->onAccessBitmap(); 98 const SkBitmap& bitmap = this->onAccessBitmap();
99 if (changePixels) { 99 if (changePixels) {
100 bitmap.notifyPixelsChanged(); 100 bitmap.notifyPixelsChanged();
101 } 101 }
102 return bitmap; 102 return bitmap;
103 } 103 }
104 104
105 #ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
106 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y,
107 SkCanvas::Config8888 config8888) {
108 if (SkBitmap::kARGB_8888_Config != bitmap->config() ||
109 NULL != bitmap->getTexture()) {
110 return false;
111 }
112
113 const SkBitmap& src = this->accessBitmap(false);
114
115 SkIRect srcRect = SkIRect::MakeXYWH(x, y, bitmap->width(),
116 bitmap->height());
117 SkIRect devbounds = SkIRect::MakeWH(src.width(), src.height());
118 if (!srcRect.intersect(devbounds)) {
119 return false;
120 }
121
122 SkBitmap tmp;
123 SkBitmap* bmp;
124 if (bitmap->isNull()) {
125 if (!tmp.allocPixels(SkImageInfo::MakeN32Premul(bitmap->width(),
126 bitmap->height()))) {
127 return false;
128 }
129 bmp = &tmp;
130 } else {
131 bmp = bitmap;
132 }
133
134 SkIRect subrect = srcRect;
135 subrect.offset(-x, -y);
136 SkBitmap bmpSubset;
137 bmp->extractSubset(&bmpSubset, subrect);
138
139 bool result = this->onReadPixels(bmpSubset,
140 srcRect.fLeft,
141 srcRect.fTop,
142 config8888);
143 if (result && bmp == &tmp) {
144 tmp.swap(*bitmap);
145 }
146 return result;
147 }
148 bool SkBaseDevice::onReadPixels(const SkBitmap&, int x, int y, SkCanvas::Config8 888) {
149 return false;
150 }
151 #endif
152
153 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } 105 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; }
154 106
155 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } 107 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; }
156 108
157 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 109 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
158 const SkRRect& inner, const SkPaint& paint) { 110 const SkRRect& inner, const SkPaint& paint) {
159 SkPath path; 111 SkPath path;
160 path.addRRect(outer); 112 path.addRRect(outer);
161 path.addRRect(inner); 113 path.addRRect(inner);
162 path.setFillType(SkPath::kEvenOdd_FillType); 114 path.setFillType(SkPath::kEvenOdd_FillType);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 172 }
221 173
222 void SkBaseDevice::EXPERIMENTAL_optimize(SkPicture* picture) { 174 void SkBaseDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
223 // The base class doesn't perform any analysis but derived classes may 175 // The base class doesn't perform any analysis but derived classes may
224 } 176 }
225 177
226 bool SkBaseDevice::EXPERIMENTAL_drawPicture(const SkPicture& picture) { 178 bool SkBaseDevice::EXPERIMENTAL_drawPicture(const SkPicture& picture) {
227 // The base class doesn't perform any accelerated picture rendering 179 // The base class doesn't perform any accelerated picture rendering
228 return false; 180 return false;
229 } 181 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/device/xps/SkXPSDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698