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

Side by Side Diff: include/core/SkImageFilter.h

Issue 1905753002: Image filters: remove SkBitmap-based cache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | include/effects/SkMatrixConvolutionImageFilter.h » ('j') | 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 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 #ifndef SkImageFilter_DEFINED 8 #ifndef SkImageFilter_DEFINED
9 #define SkImageFilter_DEFINED 9 #define SkImageFilter_DEFINED
10 10
11 #include "../private/SkTArray.h" 11 #include "../private/SkTArray.h"
12 #include "../private/SkTemplates.h" 12 #include "../private/SkTemplates.h"
13 #include "../private/SkMutex.h" 13 #include "../private/SkMutex.h"
14 #include "SkFilterQuality.h" 14 #include "SkFilterQuality.h"
15 #include "SkFlattenable.h" 15 #include "SkFlattenable.h"
16 #include "SkMatrix.h" 16 #include "SkMatrix.h"
17 #include "SkRect.h" 17 #include "SkRect.h"
18 #include "SkSurfaceProps.h"
19 18
20 class GrContext; 19 class GrContext;
21 class GrFragmentProcessor; 20 class GrFragmentProcessor;
22 class GrTexture;
23 class SkBaseDevice; 21 class SkBaseDevice;
24 class SkBitmap;
25 class SkColorFilter; 22 class SkColorFilter;
26 struct SkIPoint; 23 struct SkIPoint;
27 class SkSpecialImage; 24 class SkSpecialImage;
28 25
29 /** 26 /**
30 * Base class for image filters. If one is installed in the paint, then 27 * Base class for image filters. If one is installed in the paint, then
31 * all drawing occurs as usual, but it is as if the drawing happened into an 28 * all drawing occurs as usual, but it is as if the drawing happened into an
32 * offscreen (before the xfermode is applied). This offscreen bitmap will 29 * offscreen (before the xfermode is applied). This offscreen bitmap will
33 * then be handed to the imagefilter, who in turn creates a new bitmap which 30 * then be handed to the imagefilter, who in turn creates a new bitmap which
34 * is what will finally be drawn to the device (using the original xfermode). 31 * is what will finally be drawn to the device (using the original xfermode).
35 */ 32 */
36 class SK_API SkImageFilter : public SkFlattenable { 33 class SK_API SkImageFilter : public SkFlattenable {
37 public: 34 public:
38 // This cache maps from (filter's unique ID + CTM + clipBounds + src bitmap generation ID) to 35 // This cache maps from (filter's unique ID + CTM + clipBounds + src bitmap generation ID) to
39 // (result, offset). 36 // (result, offset).
40 class Cache : public SkRefCnt { 37 class Cache : public SkRefCnt {
41 public: 38 public:
42 struct Key; 39 struct Key;
43 virtual ~Cache() {} 40 virtual ~Cache() {}
44 static Cache* Create(size_t maxBytes); 41 static Cache* Create(size_t maxBytes);
45 static Cache* Get(); 42 static Cache* Get();
46 virtual bool get(const Key& key, SkBitmap* result, SkIPoint* offset) con st = 0;
47 virtual SkSpecialImage* get(const Key& key, SkIPoint* offset) const = 0; 43 virtual SkSpecialImage* get(const Key& key, SkIPoint* offset) const = 0;
48 virtual void set(const Key& key, const SkBitmap& result, const SkIPoint& offset) = 0;
49 virtual void set(const Key& key, SkSpecialImage* image, const SkIPoint& offset) = 0; 44 virtual void set(const Key& key, SkSpecialImage* image, const SkIPoint& offset) = 0;
50 virtual void purge() = 0; 45 virtual void purge() = 0;
51 virtual void purgeByKeys(const Key[], int) = 0; 46 virtual void purgeByKeys(const Key[], int) = 0;
52 SkDEBUGCODE(virtual int count() const = 0;) 47 SkDEBUGCODE(virtual int count() const = 0;)
53 }; 48 };
54 49
55 class Context { 50 class Context {
56 public: 51 public:
57 Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache) 52 Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache)
58 : fCTM(ctm) 53 : fCTM(ctm)
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 */ 396 */
402 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 397 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
403 Common localVar; \ 398 Common localVar; \
404 do { \ 399 do { \
405 if (!localVar.unflatten(buffer, expectedCount)) { \ 400 if (!localVar.unflatten(buffer, expectedCount)) { \
406 return NULL; \ 401 return NULL; \
407 } \ 402 } \
408 } while (0) 403 } while (0)
409 404
410 #endif 405 #endif
OLDNEW
« no previous file with comments | « no previous file | include/effects/SkMatrixConvolutionImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698