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

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

Issue 2261003003: store info in basedevice, change getter to non-virtual const& (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
11 #include "SkDrawFilter.h" 11 #include "SkDrawFilter.h"
12 #include "SkImage_Base.h" 12 #include "SkImage_Base.h"
13 #include "SkImageFilter.h" 13 #include "SkImageFilter.h"
14 #include "SkImageFilterCache.h" 14 #include "SkImageFilterCache.h"
15 #include "SkImagePriv.h" 15 #include "SkImagePriv.h"
16 #include "SkLatticeIter.h" 16 #include "SkLatticeIter.h"
17 #include "SkMetaData.h" 17 #include "SkMetaData.h"
18 #include "SkPatchUtils.h" 18 #include "SkPatchUtils.h"
19 #include "SkPathMeasure.h" 19 #include "SkPathMeasure.h"
20 #include "SkRasterClip.h" 20 #include "SkRasterClip.h"
21 #include "SkRSXform.h" 21 #include "SkRSXform.h"
22 #include "SkShader.h" 22 #include "SkShader.h"
23 #include "SkSpecialImage.h" 23 #include "SkSpecialImage.h"
24 #include "SkTextBlobRunIterator.h" 24 #include "SkTextBlobRunIterator.h"
25 #include "SkTextToPathIter.h" 25 #include "SkTextToPathIter.h"
26 26
27 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) : fSurfaceProps(s urfaceProps) { 27 SkBaseDevice::SkBaseDevice(const SkImageInfo& info, const SkSurfaceProps& surfac eProps)
28 : fInfo(info)
29 , fSurfaceProps(surfaceProps)
30 {
28 fOrigin.setZero(); 31 fOrigin.setZero();
29 fMetaData = nullptr; 32 fMetaData = nullptr;
30 } 33 }
31 34
32 SkBaseDevice::~SkBaseDevice() { delete fMetaData; } 35 SkBaseDevice::~SkBaseDevice() { delete fMetaData; }
33 36
34 SkMetaData& SkBaseDevice::getMetaData() { 37 SkMetaData& SkBaseDevice::getMetaData() {
35 // metadata users are rare, so we lazily allocate it. If that changes we 38 // metadata users are rare, so we lazily allocate it. If that changes we
36 // can decide to just make it a field in the device (rather than a ptr) 39 // can decide to just make it a field in the device (rather than a ptr)
37 if (nullptr == fMetaData) { 40 if (nullptr == fMetaData) {
38 fMetaData = new SkMetaData; 41 fMetaData = new SkMetaData;
39 } 42 }
40 return *fMetaData; 43 return *fMetaData;
41 } 44 }
42 45
43 SkImageInfo SkBaseDevice::imageInfo() const {
44 return SkImageInfo::MakeUnknown();
45 }
46
47 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP 46 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
48 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { 47 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
49 const SkBitmap& bitmap = this->onAccessBitmap(); 48 const SkBitmap& bitmap = this->onAccessBitmap();
50 if (changePixels) { 49 if (changePixels) {
51 bitmap.notifyPixelsChanged(); 50 bitmap.notifyPixelsChanged();
52 } 51 }
53 return bitmap; 52 return bitmap;
54 } 53 }
55 #endif 54 #endif
56 55
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 548
550 // Also log filter quality independent scale factor. 549 // Also log filter quality independent scale factor.
551 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, 550 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor,
552 kLast_ScaleFactor + 1); 551 kLast_ScaleFactor + 1);
553 552
554 // Also log an overall histogram of filter quality. 553 // Also log an overall histogram of filter quality.
555 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1); 554 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1);
556 #endif 555 #endif
557 } 556 }
558 557
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698