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) { |