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

Unified Diff: src/pipe/SkGPipeRead.cpp

Issue 1181913003: add SkCanvas::drawAtlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warnings Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeRead.cpp
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index 917bb50976197c31ad3a6e32bd081edf11613166..8d3048d76f7f3954d5c364df85fad5adea928356 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -20,11 +20,12 @@
#include "SkDrawLooper.h"
#include "SkImageFilter.h"
#include "SkMaskFilter.h"
-#include "SkReadBuffer.h"
#include "SkPatchUtils.h"
#include "SkPathEffect.h"
#include "SkRasterizer.h"
+#include "SkReadBuffer.h"
#include "SkRRect.h"
+#include "SkRSXform.h"
#include "SkShader.h"
#include "SkTextBlob.h"
#include "SkTypeface.h"
@@ -479,6 +480,33 @@ static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
}
}
+static void drawAtlas_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, SkGPipeState* state) {
+ unsigned flags = DrawOp_unpackFlags(op32);
+
+ const SkPaint* paint = NULL;
+ if (flags & kDrawAtlas_HasPaint_DrawOpFlag) {
+ paint = &state->paint();
+ }
+ const int slot = reader->readU32();
+ const SkImage* atlas = state->getImage(slot);
+ const int count = reader->readU32();
+ SkXfermode::Mode mode = (SkXfermode::Mode)reader->readU32();
+ const SkRSXform* xform = skip<SkRSXform>(reader, count);
+ const SkRect* tex = skip<SkRect>(reader, count);
+ const SkColor* colors = NULL;
+ if (flags & kDrawAtlas_HasColors_DrawOpFlag) {
+ colors = skip<SkColor>(reader, count);
+ }
+ const SkRect* cull = NULL;
+ if (flags & kDrawAtlas_HasCull_DrawOpFlag) {
+ cull = skip<SkRect>(reader, 1);
+ }
+
+ if (state->shouldDraw()) {
+ canvas->drawAtlas(atlas, xform, tex, colors, count, mode, cull, paint);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
static void drawText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
@@ -831,6 +859,7 @@ static const ReadProc gReadTable[] = {
clipRect_rp,
clipRRect_rp,
concat_rp,
+ drawAtlas_rp,
drawBitmap_rp,
drawBitmapNine_rp,
drawBitmapRect_rp,
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698