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

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 1261433009: Refugee from Dead Machine 11: Add SkCanvas::drawLitAtlas call Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 8 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/SkGPipeRead.cpp ('k') | src/ports/SkGlobalInitialization_default.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index aa04cb88f31ed07388fc2ddcbff7a1ab4dbf91bb..aedd7a44cf14c709e8b335c3705b3dcd3ced0633 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -15,6 +15,7 @@
#include "SkGPipe.h"
#include "SkGPipePriv.h"
#include "SkImageFilter.h"
+#include "SkLight.h"
#include "SkMaskFilter.h"
#include "SkRSXform.h"
#include "SkWriteBuffer.h"
@@ -292,6 +293,10 @@ protected:
const SkPaint&) override;
void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
int count, SkXfermode::Mode, const SkRect* cull, const SkPaint*) override;
+ void onDrawLitAtlas(const SkImage*, const SkRSXform[],
+ const SkRect diffTex[], const SkRect normTex[], const SkColor[],
+ int count, SkXfermode::Mode, const SkRect* cull,
+ const SkPaint*, const SkLight lights[], int numLights) override;
void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
@@ -1154,6 +1159,57 @@ void SkGPipeCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], c
}
}
+
+void SkGPipeCanvas::onDrawLitAtlas(const SkImage* atlas, const SkRSXform xform[],
+ const SkRect diffTex[], const SkRect normTex[],
+ const SkColor colors[], int count,
+ SkXfermode::Mode mode, const SkRect* cull,
+ const SkPaint* paint,
+ const SkLight lights[], int numLights) {
+ NOTIFY_SETUP(this);
+ unsigned flags = 0; // packs with the op, so needs no extra space
+
+ if (paint) {
+ flags |= kDrawAtlas_HasPaint_DrawOpFlag;
+ this->writePaint(*paint);
+ }
+
+ size_t size = 4; // image-slot
+ size += 4; // count
+ size += 4; // mode
+ size += 4; // num lights
+ size += count * sizeof(SkRSXform); // xform
+ size += 2 * count * sizeof(SkRect); // diffTex + normTex
+ if (colors) {
+ flags |= kDrawAtlas_HasColors_DrawOpFlag;
+ size += count * sizeof(SkColor); // colors
+ }
+ if (cull) {
+ flags |= kDrawAtlas_HasCull_DrawOpFlag;
+ size += sizeof(SkRect); // cull
+ }
+ size += numLights * sizeof(SkLight); // lights
+
+ if (this->needOpBytes(size)) {
+ this->writeOp(kDrawLitAtlas_DrawOp, flags, 0);
+ int32_t slot = fImageHeap->insert(atlas);
+ fWriter.write32(slot);
+ fWriter.write32(count);
+ fWriter.write32(mode);
+ fWriter.write(xform, count * sizeof(SkRSXform));
+ fWriter.write(diffTex, count * sizeof(SkRect));
+ fWriter.write(normTex, count * sizeof(SkRect));
+ if (colors) {
+ fWriter.write(colors, count * sizeof(SkColor));
+ }
+ if (cull) {
+ fWriter.writeRect(*cull);
+ }
+ fWriter.write32(numLights);
+ fWriter.write(lights, numLights * sizeof(SkLight));
+ }
+}
+
void SkGPipeCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode,
const SkPaint& paint) {
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | src/ports/SkGlobalInitialization_default.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698