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

Side by Side Diff: src/core/SkSpecialImage.h

Issue 1813813002: Add SkSpecialImage::makeTextureImage entry point & update filterInput (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix possible nullptr dereference Created 4 years, 9 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 | « src/core/SkImageFilter.cpp ('k') | src/core/SkSpecialImage.cpp » ('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 2016 Google Inc. 2 * Copyright 2016 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 SkSpecialImage_DEFINED 8 #ifndef SkSpecialImage_DEFINED
9 #define SkSpecialImage_DEFINED 9 #define SkSpecialImage_DEFINED
10 10
11 #include "SkNextID.h" 11 #include "SkNextID.h"
12 #include "SkRefCnt.h" 12 #include "SkRefCnt.h"
13 13
14 // remove this when internal_getProxy goes away (see skbug.com/4965) 14 // remove this when internal_getProxy goes away (see skbug.com/4965)
15 #include "SkImageFilter.h" 15 #include "SkImageFilter.h"
16 16
17 #include "SkImageInfo.h" // for SkAlphaType
18
19 class GrContext;
17 class GrTexture; 20 class GrTexture;
18 class SkBitmap; 21 class SkBitmap;
19 class SkCanvas; 22 class SkCanvas;
20 class SkImage; 23 class SkImage;
21 struct SkImageInfo; 24 struct SkImageInfo;
22 class SkPaint; 25 class SkPaint;
26 class SkPixmap;
23 class SkSpecialSurface; 27 class SkSpecialSurface;
24 28
25 enum { 29 enum {
26 kNeedNewImageUniqueID_SpecialImage = 0 30 kNeedNewImageUniqueID_SpecialImage = 0
27 }; 31 };
28 32
29 /** 33 /**
30 * This is a restricted form of SkImage solely intended for internal use. It 34 * This is a restricted form of SkImage solely intended for internal use. It
31 * differs from SkImage in that: 35 * differs from SkImage in that:
32 * - it can only be backed by raster or gpu (no generators) 36 * - it can only be backed by raster or gpu (no generators)
(...skipping 11 matching lines...) Expand all
44 48
45 int width() const { return fSubset.width(); } 49 int width() const { return fSubset.width(); }
46 int height() const { return fSubset.height(); } 50 int height() const { return fSubset.height(); }
47 const SkIRect& subset() const { return fSubset; } 51 const SkIRect& subset() const { return fSubset; }
48 52
49 uint32_t uniqueID() const { return fUniqueID; } 53 uint32_t uniqueID() const { return fUniqueID; }
50 virtual bool isOpaque() const { return false; } 54 virtual bool isOpaque() const { return false; }
51 virtual size_t getSize() const = 0; 55 virtual size_t getSize() const = 0;
52 56
53 /** 57 /**
58 * Ensures that a special image is backed by a texture (when GrContext is n on-null). If no
59 * transformation is required, the returned image may be the same as this s pecial image.
60 * If this special image is from a different GrContext, this will fail.
61 */
62 sk_sp<SkSpecialImage> makeTextureImage(SkImageFilter::Proxy*, GrContext*);
63
64 /**
54 * Draw this SpecialImage into the canvas. 65 * Draw this SpecialImage into the canvas.
55 */ 66 */
56 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; 67 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const;
57 68
58 static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*, 69 static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*,
59 const SkIRect& subset, 70 const SkIRect& subset,
60 sk_sp<SkImage>); 71 sk_sp<SkImage>);
61 static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*, 72 static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*,
62 const SkIRect& subset, 73 const SkIRect& subset,
63 const SkBitmap&); 74 const SkBitmap&);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 const uint32_t fUniqueID; 144 const uint32_t fUniqueID;
134 145
135 // TODO: remove this ASAP (see skbug.com/4965) 146 // TODO: remove this ASAP (see skbug.com/4965)
136 SkImageFilter::Proxy* fProxy; 147 SkImageFilter::Proxy* fProxy;
137 148
138 typedef SkRefCnt INHERITED; 149 typedef SkRefCnt INHERITED;
139 }; 150 };
140 151
141 #endif 152 #endif
142 153
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698