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

Side by Side Diff: src/gpu/SkGpuDevice.h

Issue 1228083004: add src-rect-constraint to drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 5 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/gpu/GrRecordReplaceDraw.cpp ('k') | src/gpu/SkGpuDevice.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkGpuDevice_DEFINED 9 #ifndef SkGpuDevice_DEFINED
10 #define SkGpuDevice_DEFINED 10 #define SkGpuDevice_DEFINED
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual void drawOval(const SkDraw&, const SkRect& oval, 89 virtual void drawOval(const SkDraw&, const SkRect& oval,
90 const SkPaint& paint) override; 90 const SkPaint& paint) override;
91 virtual void drawPath(const SkDraw&, const SkPath& path, 91 virtual void drawPath(const SkDraw&, const SkPath& path,
92 const SkPaint& paint, const SkMatrix* prePathMatrix, 92 const SkPaint& paint, const SkMatrix* prePathMatrix,
93 bool pathIsMutable) override; 93 bool pathIsMutable) override;
94 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, 94 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
95 const SkMatrix&, const SkPaint&) override; 95 const SkMatrix&, const SkPaint&) override;
96 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, 96 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&,
97 const SkRect* srcOrNull, const SkRect& dst, 97 const SkRect* srcOrNull, const SkRect& dst,
98 const SkPaint& paint, 98 const SkPaint& paint,
99 SkCanvas::DrawBitmapRectFlags flags) override; 99 SK_VIRTUAL_CONSTRAINT_TYPE) override;
100 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, 100 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
101 int x, int y, const SkPaint& paint) override; 101 int x, int y, const SkPaint& paint) override;
102 virtual void drawText(const SkDraw&, const void* text, size_t len, 102 virtual void drawText(const SkDraw&, const void* text, size_t len,
103 SkScalar x, SkScalar y, const SkPaint&) override; 103 SkScalar x, SkScalar y, const SkPaint&) override;
104 virtual void drawPosText(const SkDraw&, const void* text, size_t len, 104 virtual void drawPosText(const SkDraw&, const void* text, size_t len,
105 const SkScalar pos[], int scalarsPerPos, 105 const SkScalar pos[], int scalarsPerPos,
106 const SkPoint& offset, const SkPaint&) override; 106 const SkPoint& offset, const SkPaint&) override;
107 virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkSc alar y, 107 virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkSc alar y,
108 const SkPaint& paint, SkDrawFilter* drawFilter) ov erride; 108 const SkPaint& paint, SkDrawFilter* drawFilter) ov erride;
109 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou nt, 109 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou nt,
110 const SkPoint verts[], const SkPoint texs[], 110 const SkPoint verts[], const SkPoint texs[],
111 const SkColor colors[], SkXfermode* xmode, 111 const SkColor colors[], SkXfermode* xmode,
112 const uint16_t indices[], int indexCount, 112 const uint16_t indices[], int indexCount,
113 const SkPaint&) override; 113 const SkPaint&) override;
114 void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const SkRect[], 114 void drawAtlas(const SkDraw&, const SkImage* atlas, const SkRSXform[], const SkRect[],
115 const SkColor[], int count, SkXfermode::Mode, const SkPai nt&) override; 115 const SkColor[], int count, SkXfermode::Mode, const SkPai nt&) override;
116 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, 116 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
117 const SkPaint&) override; 117 const SkPaint&) override;
118 void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const SkPaint&) override; 118 void drawImage(const SkDraw&, const SkImage*, SkScalar x, SkScalar y, const SkPaint&) override;
119 void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const S kRect& dst, 119 void drawImageRect(const SkDraw&, const SkImage*, const SkRect* src, const S kRect& dst,
120 const SkPaint&) override; 120 const SkPaint&, SkCanvas::SrcRectConstraint) override;
121 121
122 void flush() override; 122 void flush() override;
123 123
124 void onAttachToCanvas(SkCanvas* canvas) override; 124 void onAttachToCanvas(SkCanvas* canvas) override;
125 void onDetachFromCanvas() override; 125 void onDetachFromCanvas() override;
126 126
127 const SkBitmap& onAccessBitmap() override; 127 const SkBitmap& onAccessBitmap() override;
128 bool onAccessPixels(SkPixmap*) override; 128 bool onAccessPixels(SkPixmap*) override;
129 129
130 bool canHandleImageFilter(const SkImageFilter*) override; 130 bool canHandleImageFilter(const SkImageFilter*) override;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void prepareDraw(const SkDraw&); 180 void prepareDraw(const SkDraw&);
181 181
182 /** 182 /**
183 * Implementation for both drawBitmap and drawBitmapRect. 183 * Implementation for both drawBitmap and drawBitmapRect.
184 */ 184 */
185 void drawBitmapCommon(const SkDraw&, 185 void drawBitmapCommon(const SkDraw&,
186 const SkBitmap& bitmap, 186 const SkBitmap& bitmap,
187 const SkRect* srcRectPtr, 187 const SkRect* srcRectPtr,
188 const SkSize* dstSizePtr, // ignored iff srcRectP tr == NULL 188 const SkSize* dstSizePtr, // ignored iff srcRectP tr == NULL
189 const SkPaint&, 189 const SkPaint&,
190 SkCanvas::DrawBitmapRectFlags flags); 190 SkCanvas::SrcRectConstraint);
191 191
192 /** 192 /**
193 * Helper functions called by drawBitmapCommon. By the time these are called the SkDraw's 193 * Helper functions called by drawBitmapCommon. By the time these are called the SkDraw's
194 * matrix, clip, and the device's render target has already been set on GrCo ntext. 194 * matrix, clip, and the device's render target has already been set on GrCo ntext.
195 */ 195 */
196 196
197 // The tileSize and clippedSrcRect will be valid only if true is returned. 197 // The tileSize and clippedSrcRect will be valid only if true is returned.
198 bool shouldTileBitmap(const SkBitmap& bitmap, 198 bool shouldTileBitmap(const SkBitmap& bitmap,
199 const SkMatrix& viewMatrix, 199 const SkMatrix& viewMatrix,
200 const GrTextureParams& sampler, 200 const GrTextureParams& sampler,
201 const SkRect* srcRectPtr, 201 const SkRect* srcRectPtr,
202 int maxTileSize, 202 int maxTileSize,
203 int* tileSize, 203 int* tileSize,
204 SkIRect* clippedSrcRect) const; 204 SkIRect* clippedSrcRect) const;
205 void internalDrawBitmap(const SkBitmap&, 205 void internalDrawBitmap(const SkBitmap&,
206 const SkMatrix& viewMatrix, 206 const SkMatrix& viewMatrix,
207 const SkRect&, 207 const SkRect&,
208 const GrTextureParams& params, 208 const GrTextureParams& params,
209 const SkPaint& paint, 209 const SkPaint& paint,
210 SkCanvas::DrawBitmapRectFlags flags, 210 SkCanvas::SrcRectConstraint,
211 bool bicubic, 211 bool bicubic,
212 bool needsTextureDomain); 212 bool needsTextureDomain);
213 void drawTiledBitmap(const SkBitmap& bitmap, 213 void drawTiledBitmap(const SkBitmap& bitmap,
214 const SkMatrix& viewMatrix, 214 const SkMatrix& viewMatrix,
215 const SkRect& srcRect, 215 const SkRect& srcRect,
216 const SkIRect& clippedSrcRect, 216 const SkIRect& clippedSrcRect,
217 const GrTextureParams& params, 217 const GrTextureParams& params,
218 const SkPaint& paint, 218 const SkPaint& paint,
219 SkCanvas::DrawBitmapRectFlags flags, 219 SkCanvas::SrcRectConstraint,
220 int tileSize, 220 int tileSize,
221 bool bicubic); 221 bool bicubic);
222 222
223 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); 223 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint);
224 224
225 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&, 225 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&,
226 int sampleCount); 226 int sampleCount);
227 227
228 friend class GrAtlasTextContext; 228 friend class GrAtlasTextContext;
229 friend class SkSurface_Gpu; // for access to surfaceProps 229 friend class SkSurface_Gpu; // for access to surfaceProps
230 typedef SkBaseDevice INHERITED; 230 typedef SkBaseDevice INHERITED;
231 }; 231 };
232 232
233 #endif 233 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrRecordReplaceDraw.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698