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

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

Issue 2120333002: deferred canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make flush virtual Created 4 years, 5 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
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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 // can decide to just make it a field in the device (rather than a ptr) 805 // can decide to just make it a field in the device (rather than a ptr)
806 if (nullptr == fMetaData) { 806 if (nullptr == fMetaData) {
807 fMetaData = new SkMetaData; 807 fMetaData = new SkMetaData;
808 } 808 }
809 return *fMetaData; 809 return *fMetaData;
810 } 810 }
811 811
812 /////////////////////////////////////////////////////////////////////////////// 812 ///////////////////////////////////////////////////////////////////////////////
813 813
814 void SkCanvas::flush() { 814 void SkCanvas::flush() {
815 this->onFlush();
816 }
817
818 void SkCanvas::onFlush() {
815 SkBaseDevice* device = this->getDevice(); 819 SkBaseDevice* device = this->getDevice();
816 if (device) { 820 if (device) {
817 device->flush(); 821 device->flush();
818 } 822 }
819 } 823 }
820 824
821 SkISize SkCanvas::getBaseLayerSize() const { 825 SkISize SkCanvas::getBaseLayerSize() const {
822 SkBaseDevice* d = this->getDevice(); 826 SkBaseDevice* d = this->getDevice();
823 return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0); 827 return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
824 } 828 }
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } 1368 }
1365 return this->onNewSurface(info, *props); 1369 return this->onNewSurface(info, *props);
1366 } 1370 }
1367 1371
1368 sk_sp<SkSurface> SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurface Props& props) { 1372 sk_sp<SkSurface> SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurface Props& props) {
1369 SkBaseDevice* dev = this->getDevice(); 1373 SkBaseDevice* dev = this->getDevice();
1370 return dev ? dev->makeSurface(info, props) : nullptr; 1374 return dev ? dev->makeSurface(info, props) : nullptr;
1371 } 1375 }
1372 1376
1373 SkImageInfo SkCanvas::imageInfo() const { 1377 SkImageInfo SkCanvas::imageInfo() const {
1378 return this->onImageInfo();
1379 }
1380
1381 SkImageInfo SkCanvas::onImageInfo() const {
1374 SkBaseDevice* dev = this->getDevice(); 1382 SkBaseDevice* dev = this->getDevice();
1375 if (dev) { 1383 if (dev) {
1376 return dev->imageInfo(); 1384 return dev->imageInfo();
1377 } else { 1385 } else {
1378 return SkImageInfo::MakeUnknown(0, 0); 1386 return SkImageInfo::MakeUnknown(0, 0);
1379 } 1387 }
1380 } 1388 }
1381 1389
1382 bool SkCanvas::getProps(SkSurfaceProps* props) const { 1390 bool SkCanvas::getProps(SkSurfaceProps* props) const {
1391 return this->onGetProps(props);
1392 }
1393
1394 bool SkCanvas::onGetProps(SkSurfaceProps* props) const {
1383 SkBaseDevice* dev = this->getDevice(); 1395 SkBaseDevice* dev = this->getDevice();
1384 if (dev) { 1396 if (dev) {
1385 if (props) { 1397 if (props) {
1386 *props = fProps; 1398 *props = fProps;
1387 } 1399 }
1388 return true; 1400 return true;
1389 } else { 1401 } else {
1390 return false; 1402 return false;
1391 } 1403 }
1392 } 1404 }
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 2899
2888 SkRect r; 2900 SkRect r;
2889 r.set(cx - radius, cy - radius, cx + radius, cy + radius); 2901 r.set(cx - radius, cy - radius, cx + radius, cy + radius);
2890 this->drawOval(r, paint); 2902 this->drawOval(r, paint);
2891 } 2903 }
2892 2904
2893 void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry, 2905 void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry,
2894 const SkPaint& paint) { 2906 const SkPaint& paint) {
2895 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRoundRect()"); 2907 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRoundRect()");
2896 if (rx > 0 && ry > 0) { 2908 if (rx > 0 && ry > 0) {
2897 if (paint.canComputeFastBounds()) {
2898 SkRect storage;
2899 if (this->quickReject(paint.computeFastBounds(r, &storage))) {
2900 return;
2901 }
2902 }
2903 SkRRect rrect; 2909 SkRRect rrect;
2904 rrect.setRectXY(r, rx, ry); 2910 rrect.setRectXY(r, rx, ry);
2905 this->drawRRect(rrect, paint); 2911 this->drawRRect(rrect, paint);
2906 } else { 2912 } else {
2907 this->drawRect(r, paint); 2913 this->drawRect(r, paint);
2908 } 2914 }
2909 } 2915 }
2910 2916
2911 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, 2917 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle,
2912 SkScalar sweepAngle, bool useCenter, 2918 SkScalar sweepAngle, bool useCenter,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 3100
3095 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3101 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3096 fCanvas->restoreToCount(fSaveCount); 3102 fCanvas->restoreToCount(fSaveCount);
3097 } 3103 }
3098 3104
3099 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3105 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3100 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3106 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3101 return this->makeSurface(info, props).release(); 3107 return this->makeSurface(info, props).release();
3102 } 3108 }
3103 #endif 3109 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698