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

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 933483002: add Method param to drawTextOnPath, supporting SVG spec Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add guard for android Created 5 years, 10 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; 250 void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
251 251
252 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID E; 252 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID E;
253 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS calar y, 253 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS calar y,
254 const SkPaint&) SK_OVERRIDE; 254 const SkPaint&) SK_OVERRIDE;
255 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin t pos[], 255 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin t pos[],
256 const SkPaint&) SK_OVERRIDE; 256 const SkPaint&) SK_OVERRIDE;
257 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca lar xpos[], 257 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca lar xpos[],
258 SkScalar constY, const SkPaint&) SK_OVERRIDE; 258 SkScalar constY, const SkPaint&) SK_OVERRIDE;
259 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP ath& path, 259 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP ath& path,
260 const SkMatrix* matrix, const SkPaint&) SK_OVE RRIDE; 260 const SkMatrix*,
261 SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM const Sk Paint&) SK_OVERRIDE;
f(malita) 2015/02/16 15:31:50 indentation
261 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 262 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
262 const SkPaint& paint) SK_OVERRIDE; 263 const SkPaint& paint) SK_OVERRIDE;
263 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], 264 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
264 const SkPoint texCoords[4], SkXfermode* xmode, 265 const SkPoint texCoords[4], SkXfermode* xmode,
265 const SkPaint& paint) SK_OVERRIDE; 266 const SkPaint& paint) SK_OVERRIDE;
266 void onDrawPaint(const SkPaint&) SK_OVERRIDE; 267 void onDrawPaint(const SkPaint&) SK_OVERRIDE;
267 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) SK_OVERRIDE; 268 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) SK_OVERRIDE;
268 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; 269 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
269 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; 270 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
270 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; 271 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 fWriter.write32(SkToU32(byteLength)); 866 fWriter.write32(SkToU32(byteLength));
866 fWriter.writePad(text, byteLength); 867 fWriter.writePad(text, byteLength);
867 fWriter.write32(count); 868 fWriter.write32(count);
868 fWriter.write(xpos, count * sizeof(SkScalar)); 869 fWriter.write(xpos, count * sizeof(SkScalar));
869 fWriter.writeScalar(constY); 870 fWriter.writeScalar(constY);
870 } 871 }
871 } 872 }
872 } 873 }
873 874
874 void SkGPipeCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, 875 void SkGPipeCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
875 const SkMatrix* matrix, const SkPaint& pain t) { 876 const SkMatrix* matrix,
877 SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM cons t SkPaint& paint) {
878 SK_SUPPORT_LEGACY_DRAWTEXTONPATH_DEFAULT_METHOD
876 if (byteLength) { 879 if (byteLength) {
877 NOTIFY_SETUP(this); 880 NOTIFY_SETUP(this);
878 unsigned flags = 0; 881 unsigned flags = 0;
879 size_t size = 4 + SkAlign4(byteLength) + path.writeToMemory(NULL); 882 size_t size = 4 + SkAlign4(byteLength) + path.writeToMemory(NULL);
880 if (matrix) { 883 if (matrix) {
881 flags |= kDrawTextOnPath_HasMatrix_DrawOpFlag; 884 flags |= kDrawTextOnPath_HasMatrix_DrawOpFlag;
882 size += matrix->writeToMemory(NULL); 885 size += matrix->writeToMemory(NULL);
883 } 886 }
884 this->writePaint(paint); 887 this->writePaint(paint);
885 if (this->needOpBytes(size)) { 888 if (this->needOpBytes(size)) {
886 this->writeOp(kDrawTextOnPath_DrawOp, flags, 0); 889 this->writeOp(kDrawTextOnPath_DrawOp, flags, 0);
887 890
888 fWriter.write32(SkToU32(byteLength)); 891 fWriter.write32(SkToU32(byteLength));
889 fWriter.writePad(text, byteLength); 892 fWriter.writePad(text, byteLength);
890 893
891 fWriter.writePath(path); 894 fWriter.writePath(path);
892 if (matrix) { 895 if (matrix) {
893 fWriter.writeMatrix(*matrix); 896 fWriter.writeMatrix(*matrix);
894 } 897 }
898 fWriter.write32(method);
895 } 899 }
896 } 900 }
897 } 901 }
898 902
899 size_t SkGPipeCanvas::getInProcessTypefaces(const SkRefCntSet& typefaceSet, 903 size_t SkGPipeCanvas::getInProcessTypefaces(const SkRefCntSet& typefaceSet,
900 TypefaceBuffer* buffer) { 904 TypefaceBuffer* buffer) {
901 // When in-process, we simply write out the typeface pointers. 905 // When in-process, we simply write out the typeface pointers.
902 size_t size = typefaceSet.count() * sizeof(SkTypeface*); 906 size_t size = typefaceSet.count() * sizeof(SkTypeface*);
903 buffer->reset(size); 907 buffer->reset(size);
904 typefaceSet.copyToArray(reinterpret_cast<SkRefCnt**>(buffer->get())); 908 typefaceSet.copyToArray(reinterpret_cast<SkRefCnt**>(buffer->get()));
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 return fCanvas->shuttleBitmap(bitmap, slot); 1334 return fCanvas->shuttleBitmap(bitmap, slot);
1331 } 1335 }
1332 1336
1333 void BitmapShuttle::removeCanvas() { 1337 void BitmapShuttle::removeCanvas() {
1334 if (NULL == fCanvas) { 1338 if (NULL == fCanvas) {
1335 return; 1339 return;
1336 } 1340 }
1337 fCanvas->unref(); 1341 fCanvas->unref();
1338 fCanvas = NULL; 1342 fCanvas = NULL;
1339 } 1343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698