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

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

Issue 535953002: Replace SkPictureReplacementPlayback with GrRecordReplaceDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix leak in SkImage creation (in test) Created 6 years, 3 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 | « include/core/SkDrawPictureCallback.h ('k') | src/gpu/GrRecordReplaceDraw.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrRecordReplaceDraw_DEFINED
9 #define GrRecordReplaceDraw_DEFINED
10
11 #include "SkDrawPictureCallback.h"
12 #include "SkRect.h"
13 #include "SkTDArray.h"
14
15 class SkBBoxHierarchy;
16 class SkBitmap;
17 class SkCanvas;
18 class SkImage;
19 class SkPaint;
20 class SkRecord;
21
22 // GrReplacements collects op ranges that can be replaced with
23 // a single drawBitmap call (using a precomputed bitmap).
24 class GrReplacements {
25 public:
26 // All the operations between fStart and fStop (inclusive) will be replaced with
27 // a single drawBitmap call using fPos, fBM and fPaint.
28 struct ReplacementInfo {
29 unsigned fStart;
30 unsigned fStop;
31 SkIPoint fPos;
32 SkImage* fImage; // Owns a ref
33 const SkPaint* fPaint; // Note: this object doesn't own the paint
34
35 SkIRect fSrcRect;
36 };
37
38 ~GrReplacements() { this->freeAll(); }
39
40 // Add a new replacement range. The replacement ranges should be
41 // sorted in increasing order and non-overlapping (esp. no nested
42 // saveLayers).
43 ReplacementInfo* push();
44
45 // look up a replacement range by its start offset.
46 // lastLookedUp is an in/out parameter that is used to speed up the search.
47 // It should be initialized to 0 on the first call and then passed back in
48 // unmodified on subsequent calls.
49 const ReplacementInfo* lookupByStart(size_t start, int* lastLookedUp) const;
50
51 private:
52 SkTDArray<ReplacementInfo> fReplacements;
53
54 void freeAll();
55
56 #ifdef SK_DEBUG
57 void validate() const;
58 #endif
59 };
60
61 // Draw an SkRecord into an SkCanvas replacing saveLayer/restore blocks with
62 // drawBitmap calls. A convenience wrapper around SkRecords::Draw.
63 void GrRecordReplaceDraw(const SkRecord&,
64 SkCanvas*,
65 const SkBBoxHierarchy*,
66 const GrReplacements*,
67 SkDrawPictureCallback*);
68
69 #endif // GrRecordReplaceDraw_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkDrawPictureCallback.h ('k') | src/gpu/GrRecordReplaceDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698