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

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

Issue 2177063002: lockPixelsAreWritable is deprecated (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update test Created 4 years, 4 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
« no previous file with comments | « include/core/SkBitmap.h ('k') | tests/ReadPixelsTest.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 2013 Google Inc. 2 * Copyright 2013 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 "SkConfig8888.h" 9 #include "SkConfig8888.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa int*) { 135 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa int*) {
136 const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixel Geometry); 136 const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixel Geometry);
137 return SkBitmapDevice::Create(cinfo.fInfo, surfaceProps); 137 return SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
138 } 138 }
139 139
140 const SkBitmap& SkBitmapDevice::onAccessBitmap() { 140 const SkBitmap& SkBitmapDevice::onAccessBitmap() {
141 return fBitmap; 141 return fBitmap;
142 } 142 }
143 143
144 bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) { 144 bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
145 if (fBitmap.lockPixelsAreWritable() && this->onPeekPixels(pmap)) { 145 if (this->onPeekPixels(pmap)) {
146 fBitmap.notifyPixelsChanged(); 146 fBitmap.notifyPixelsChanged();
147 return true; 147 return true;
148 } 148 }
149 return false; 149 return false;
150 } 150 }
151 151
152 bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) { 152 bool SkBitmapDevice::onPeekPixels(SkPixmap* pmap) {
153 const SkImageInfo info = fBitmap.info(); 153 const SkImageInfo info = fBitmap.info();
154 if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) { 154 if (fBitmap.getPixels() && (kUnknown_SkColorType != info.colorType())) {
155 SkColorTable* ctable = nullptr; 155 SkColorTable* ctable = nullptr;
(...skipping 22 matching lines...) Expand all
178 return false; 178 return false;
179 } 179 }
180 180
181 bool SkBitmapDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, s ize_t dstRowBytes, 181 bool SkBitmapDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, s ize_t dstRowBytes,
182 int x, int y) { 182 int x, int y) {
183 return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, x, y); 183 return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
184 } 184 }
185 185
186 void SkBitmapDevice::onAttachToCanvas(SkCanvas* canvas) { 186 void SkBitmapDevice::onAttachToCanvas(SkCanvas* canvas) {
187 INHERITED::onAttachToCanvas(canvas); 187 INHERITED::onAttachToCanvas(canvas);
188 if (fBitmap.lockPixelsAreWritable()) { 188 fBitmap.lockPixels();
189 fBitmap.lockPixels();
190 }
191 } 189 }
192 190
193 void SkBitmapDevice::onDetachFromCanvas() { 191 void SkBitmapDevice::onDetachFromCanvas() {
194 INHERITED::onDetachFromCanvas(); 192 INHERITED::onDetachFromCanvas();
195 if (fBitmap.lockPixelsAreWritable()) { 193 fBitmap.unlockPixels();
196 fBitmap.unlockPixels();
197 }
198 } 194 }
199 195
200 /////////////////////////////////////////////////////////////////////////////// 196 ///////////////////////////////////////////////////////////////////////////////
201 197
202 void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 198 void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
203 draw.drawPaint(paint); 199 draw.drawPaint(paint);
204 } 200 }
205 201
206 void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, si ze_t count, 202 void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, si ze_t count,
207 const SkPoint pts[], const SkPaint& paint) { 203 const SkPoint pts[], const SkPaint& paint) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 paint.getRasterizer() || 428 paint.getRasterizer() ||
433 paint.getPathEffect() || 429 paint.getPathEffect() ||
434 paint.isFakeBoldText() || 430 paint.isFakeBoldText() ||
435 paint.getStyle() != SkPaint::kFill_Style || 431 paint.getStyle() != SkPaint::kFill_Style ||
436 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) 432 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode))
437 { 433 {
438 return true; 434 return true;
439 } 435 }
440 return false; 436 return false;
441 } 437 }
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698