Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8c14038

Browse files
reed-at-googleSkia Commit-Bot
authored andcommitted
hide getMetaData()
Bug: skia: Change-Id: I2b513d4c5868bc0d4cdcdf0c95cc35e90c98f9a1 Reviewed-on: https://skia-review.googlesource.com/c/188824 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com> Auto-Submit: Mike Reed <reed@google.com>
1 parent 6913063 commit 8c14038

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

include/core/SkCanvas.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class SkFont;
4141
class SkGlyphRunBuilder;
4242
class SkImage;
4343
class SkImageFilter;
44-
class SkMetaData;
4544
class SkPath;
4645
class SkPicture;
4746
class SkPixmap;
@@ -52,6 +51,10 @@ class SkSurface;
5251
class SkSurface_Base;
5352
class SkTextBlob;
5453

54+
#ifdef SK_SUPPORT_LEGACY_CANVAS_METADATA
55+
class SkMetaData;
56+
#endif
57+
5558
/** \class SkCanvas
5659
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
5760
SkCanvas contains a stack of SkMatrix and clip values.
@@ -217,13 +220,14 @@ class SK_API SkCanvas {
217220
*/
218221
virtual ~SkCanvas();
219222

223+
#ifdef SK_SUPPORT_LEGACY_CANVAS_METADATA
220224
/** Returns storage to associate additional data with the canvas.
221225
The storage is freed when SkCanvas is deleted.
222226
223227
@return storage that can be read from and written to
224228
*/
225229
SkMetaData& getMetaData();
226-
230+
#endif
227231
/** Returns SkImageInfo for SkCanvas. If SkCanvas is not associated with raster surface or
228232
GPU surface, returned SkColorType is set to kUnknown_SkColorType.
229233
@@ -2519,7 +2523,9 @@ class SK_API SkCanvas {
25192523

25202524
int fSaveCount; // value returned by getSaveCount()
25212525

2526+
#ifdef SK_SUPPORT_LEGACY_CANVAS_METADATA
25222527
SkMetaData* fMetaData;
2528+
#endif
25232529
std::unique_ptr<SkRasterHandleAllocator> fAllocator;
25242530

25252531
SkSurface_Base* fSurfaceBase;

src/core/SkCanvas.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ void SkCanvas::resetForNextPicture(const SkIRect& bounds) {
551551
void SkCanvas::init(sk_sp<SkBaseDevice> device) {
552552
fAllowSimplifyClip = false;
553553
fSaveCount = 1;
554+
#ifdef SK_SUPPORT_LEGACY_CANVAS_METADATA
554555
fMetaData = nullptr;
556+
#endif
555557

556558
fMCRec = (MCRec*)fMCStack.push_back();
557559
new (fMCRec) MCRec;
@@ -660,11 +662,14 @@ SkCanvas::~SkCanvas() {
660662

661663
this->internalRestore(); // restore the last, since we're going away
662664

665+
#ifdef SK_SUPPORT_LEGACY_CANVAS_METADATA
663666
delete fMetaData;
667+
#endif
664668

665669
dec_canvas();
666670
}
667671

672+
#ifdef SK_SUPPORT_LEGACY_CANVAS_METADATA
668673
SkMetaData& SkCanvas::getMetaData() {
669674
// metadata users are rare, so we lazily allocate it. If that changes we
670675
// can decide to just make it a field in the device (rather than a ptr)
@@ -673,6 +678,7 @@ SkMetaData& SkCanvas::getMetaData() {
673678
}
674679
return *fMetaData;
675680
}
681+
#endif
676682

677683
///////////////////////////////////////////////////////////////////////////////
678684

0 commit comments

Comments
 (0)