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

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

Issue 2146413002: Add SkRasterPipeline blitter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Do not leak the blitter. Created 4 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/core/SkCoreBlitters.h ('k') | src/core/SkRasterPipeline.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 SkRasterPipeline_DEFINED 8 #ifndef SkRasterPipeline_DEFINED
9 #define SkRasterPipeline_DEFINED 9 #define SkRasterPipeline_DEFINED
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // It makes next() a good bit cheaper if we hold the next function to ca ll here, 66 // It makes next() a good bit cheaper if we hold the next function to ca ll here,
67 // rather than logically simpler choice of the function implementing thi s stage. 67 // rather than logically simpler choice of the function implementing thi s stage.
68 Fn fNext; 68 Fn fNext;
69 void* fCtx; 69 void* fCtx;
70 }; 70 };
71 71
72 72
73 SkRasterPipeline(); 73 SkRasterPipeline();
74 74
75 // Run the pipeline constructed with append(), walking x through [0,n), 75 // Run the pipeline constructed with append(), walking x through [x,x+n),
76 // generally in 4 pixel steps, but sometimes 1 pixel at a time. 76 // generally in 4 pixel steps, but sometimes 1 pixel at a time.
77 void run(size_t n); 77 void run(size_t x, size_t n);
78 void run(size_t n) { this->run(0, n); }
78 79
79 // Use this append() if your stage is sensitive to the number of pixels you' re working with: 80 // Use this append() if your stage is sensitive to the number of pixels you' re working with:
80 // - body will always be called for a full 4 pixels 81 // - body will always be called for a full 4 pixels
81 // - tail will always be called for a single pixel 82 // - tail will always be called for a single pixel
82 // Typically this is only an essential distintion for stages that read or wr ite memory. 83 // Typically this is only an essential distintion for stages that read or wr ite memory.
83 void append(Fn body, const void* body_ctx, 84 void append(Fn body, const void* body_ctx,
84 Fn tail, const void* tail_ctx); 85 Fn tail, const void* tail_ctx);
85 86
86 // Most stages don't actually care if they're working on 4 or 1 pixel. 87 // Most stages don't actually care if they're working on 4 or 1 pixel.
87 void append(Fn fn, const void* ctx = nullptr) { 88 void append(Fn fn, const void* ctx = nullptr) {
88 this->append(fn, ctx, fn, ctx); 89 this->append(fn, ctx, fn, ctx);
89 } 90 }
90 91
91 // Most 4 pixel or 1 pixel variants share the same context pointer. 92 // Most 4 pixel or 1 pixel variants share the same context pointer.
92 void append(Fn body, Fn tail, const void* ctx = nullptr) { 93 void append(Fn body, Fn tail, const void* ctx = nullptr) {
93 this->append(body, ctx, tail, ctx); 94 this->append(body, ctx, tail, ctx);
94 } 95 }
95 96
97 // Append all stages to this pipeline.
98 void extend(const SkRasterPipeline&);
99
96 private: 100 private:
97 using Stages = SkSTArray<10, Stage, /*MEM_COPY=*/true>; 101 using Stages = SkSTArray<10, Stage, /*MEM_COPY=*/true>;
98 102
99 // This no-op default makes fBodyStart and fTailStart unconditionally safe t o call, 103 // This no-op default makes fBodyStart and fTailStart unconditionally safe t o call,
100 // and is always the last stage's fNext as a sort of safety net to make sure even a 104 // and is always the last stage's fNext as a sort of safety net to make sure even a
101 // buggy pipeline can't walk off its own end. 105 // buggy pipeline can't walk off its own end.
102 static void SK_VECTORCALL JustReturn(Stage*, size_t, Sk4f,Sk4f,Sk4f,Sk4f, 106 static void SK_VECTORCALL JustReturn(Stage*, size_t, Sk4f,Sk4f,Sk4f,Sk4f,
103 Sk4f,Sk4f,Sk4f,Sk4f); 107 Sk4f,Sk4f,Sk4f,Sk4f);
104 108
105 Stages fBody, 109 Stages fBody,
106 fTail; 110 fTail;
107 Fn fBodyStart = &JustReturn, 111 Fn fBodyStart = &JustReturn,
108 fTailStart = &JustReturn; 112 fTailStart = &JustReturn;
109 }; 113 };
110 114
111 #endif//SkRasterPipeline_DEFINED 115 #endif//SkRasterPipeline_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkCoreBlitters.h ('k') | src/core/SkRasterPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698