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

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

Issue 1271033002: private iterator to visit all resource cache entries (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add iter for fontcache Created 5 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 2014 Google Inc. 2 * Copyright 2014 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 "SkPictureShader.h" 8 #include "SkPictureShader.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 , fBitmapBytes(bitmapBytes) {} 68 , fBitmapBytes(bitmapBytes) {}
69 69
70 BitmapShaderKey fKey; 70 BitmapShaderKey fKey;
71 SkAutoTUnref<SkShader> fShader; 71 SkAutoTUnref<SkShader> fShader;
72 size_t fBitmapBytes; 72 size_t fBitmapBytes;
73 73
74 const Key& getKey() const override { return fKey; } 74 const Key& getKey() const override { return fKey; }
75 size_t bytesUsed() const override { 75 size_t bytesUsed() const override {
76 return sizeof(fKey) + sizeof(SkShader) + fBitmapBytes; 76 return sizeof(fKey) + sizeof(SkShader) + fBitmapBytes;
77 } 77 }
78 const char* getCategory() const override { return "bitmap-shader"; }
79 SkDiscardableMemory* diagnostic_only_getDiscardable() const override { retur n nullptr; }
78 80
79 static bool Visitor(const SkResourceCache::Rec& baseRec, void* contextShader ) { 81 static bool Visitor(const SkResourceCache::Rec& baseRec, void* contextShader ) {
80 const BitmapShaderRec& rec = static_cast<const BitmapShaderRec&>(baseRec ); 82 const BitmapShaderRec& rec = static_cast<const BitmapShaderRec&>(baseRec );
81 SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader> *>(contextShader); 83 SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader> *>(contextShader);
82 84
83 result->reset(SkRef(rec.fShader.get())); 85 result->reset(SkRef(rec.fShader.get()));
84 86
85 SkBitmap tile; 87 SkBitmap tile;
86 rec.fShader.get()->asABitmap(&tile, NULL, NULL); 88 rec.fShader.get()->asABitmap(&tile, NULL, NULL);
87 // FIXME: this doesn't protect the pixels from being discarded as soon a s we unlock. 89 // FIXME: this doesn't protect the pixels from being discarded as soon a s we unlock.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 procDataManager, fp); 352 procDataManager, fp);
351 } 353 }
352 #else 354 #else
353 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix&, 355 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix&,
354 const SkMatrix*, GrColor*, GrProcessor DataManager*, 356 const SkMatrix*, GrColor*, GrProcessor DataManager*,
355 GrFragmentProcessor**) const { 357 GrFragmentProcessor**) const {
356 SkDEBUGFAIL("Should not call in GPU-less build"); 358 SkDEBUGFAIL("Should not call in GPU-less build");
357 return false; 359 return false;
358 } 360 }
359 #endif 361 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698