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

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

Issue 1550583002: remove unused SkAutoROCanvasPixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 12 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/SkCanvas.h ('k') | no next file » | 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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 *origin = this->getTopDevice(false)->getOrigin(); 1388 *origin = this->getTopDevice(false)->getOrigin();
1389 } 1389 }
1390 return pmap.writable_addr(); 1390 return pmap.writable_addr();
1391 } 1391 }
1392 1392
1393 bool SkCanvas::onAccessTopLayerPixels(SkPixmap* pmap) { 1393 bool SkCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
1394 SkBaseDevice* dev = this->getTopDevice(); 1394 SkBaseDevice* dev = this->getTopDevice();
1395 return dev && dev->accessPixels(pmap); 1395 return dev && dev->accessPixels(pmap);
1396 } 1396 }
1397 1397
1398 SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) {
1399 fAddr = canvas->peekPixels(&fInfo, &fRowBytes);
1400 if (nullptr == fAddr) {
1401 fInfo = canvas->imageInfo();
1402 if (kUnknown_SkColorType == fInfo.colorType() || !fBitmap.tryAllocPixels (fInfo)) {
1403 return; // failure, fAddr is nullptr
1404 }
1405 if (!canvas->readPixels(&fBitmap, 0, 0)) {
1406 return; // failure, fAddr is nullptr
1407 }
1408 fAddr = fBitmap.getPixels();
1409 fRowBytes = fBitmap.rowBytes();
1410 }
1411 SkASSERT(fAddr); // success
1412 }
1413
1414 bool SkAutoROCanvasPixels::asROBitmap(SkBitmap* bitmap) const {
1415 if (fAddr) {
1416 return bitmap->installPixels(fInfo, const_cast<void*>(fAddr), fRowBytes) ;
1417 } else {
1418 bitmap->reset();
1419 return false;
1420 }
1421 }
1422
1423 ///////////////////////////////////////////////////////////////////////////// 1398 /////////////////////////////////////////////////////////////////////////////
1424 1399
1425 void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, 1400 void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
1426 const SkPaint* paint, bool deviceIsBitmapDevic e) { 1401 const SkPaint* paint, bool deviceIsBitmapDevic e) {
1427 SkPaint tmp; 1402 SkPaint tmp;
1428 if (nullptr == paint) { 1403 if (nullptr == paint) {
1429 paint = &tmp; 1404 paint = &tmp;
1430 } 1405 }
1431 1406
1432 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) 1407 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type)
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 } 3010 }
3036 3011
3037 if (matrix) { 3012 if (matrix) {
3038 canvas->concat(*matrix); 3013 canvas->concat(*matrix);
3039 } 3014 }
3040 } 3015 }
3041 3016
3042 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3017 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3043 fCanvas->restoreToCount(fSaveCount); 3018 fCanvas->restoreToCount(fSaveCount);
3044 } 3019 }
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698