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

Side by Side Diff: src/core/SkRemote.cpp

Issue 1409273004: SkRemote: simple impl of onDraw*Text* (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase && add comments Created 5 years, 2 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/SkRemote.h ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 #include "SkPath.h" 8 #include "SkPath.h"
9 #include "SkRect.h" 9 #include "SkRect.h"
10 #include "SkRemote.h" 10 #include "SkRemote.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } else { 226 } else {
227 // TODO: handle kStrokeAndFill_Style 227 // TODO: handle kStrokeAndFill_Style
228 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); 228 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint)));
229 } 229 }
230 } 230 }
231 231
232 void Client::onDrawPaint(const SkPaint& paint) { 232 void Client::onDrawPaint(const SkPaint& paint) {
233 this->onDrawRect(SkRect::MakeLargest(), paint); 233 this->onDrawRect(SkRect::MakeLargest(), paint);
234 } 234 }
235 235
236 void Client::onDrawText(const void* text, size_t byteLength, SkScalar x,
237 SkScalar y, const SkPaint& paint) {
238 // Text-as-paths is a temporary hack.
239 // TODO: send SkTextBlobs and SkTypefaces
240 SkPath path;
241 paint.getTextPath(text, byteLength, x, y, &path);
242 this->onDrawPath(path, paint);
243 }
244
245 void Client::onDrawPosText(const void* text, size_t byteLength,
246 const SkPoint pos[], const SkPaint& paint) {
247 // Text-as-paths is a temporary hack.
248 // TODO: send SkTextBlobs and SkTypefaces
249 SkPath path;
250 paint.getPosTextPath(text, byteLength, pos, &path);
251 this->onDrawPath(path, paint);
252 }
253
254 void Client::onDrawPosTextH(const void* text, size_t byteLength,
255 const SkScalar xpos[], SkScalar constY,
256 const SkPaint& paint) {
257 size_t length = paint.countText(text, byteLength);
258 SkAutoTArray<SkPoint> pos(length);
259 for(size_t i = 0; i < length; ++i) {
260 pos[i].set(xpos[i], constY);
261 }
262 this->onDrawPosText(text, byteLength, &pos[0], paint);
263 }
264
236 void Client::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 265 void Client::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
237 SkPath path; 266 SkPath path;
238 path.addRect(rect); 267 path.addRect(rect);
239 this->onClipPath(path, op, edgeStyle); 268 this->onClipPath(path, op, edgeStyle);
240 } 269 }
241 270
242 void Client::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle) { 271 void Client::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle) {
243 SkPath path; 272 SkPath path;
244 path.addRRect(rrect); 273 path.addRRect(rrect);
245 this->onClipPath(path, op, edgeStyle); 274 this->onClipPath(path, op, edgeStyle);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 315 }
287 void Server::strokePath(ID path, ID misc, ID stroke) { 316 void Server::strokePath(ID path, ID misc, ID stroke) {
288 SkPaint paint; 317 SkPaint paint;
289 paint.setStyle(SkPaint::kStroke_Style); 318 paint.setStyle(SkPaint::kStroke_Style);
290 fMisc .find(misc ).applyTo(&paint); 319 fMisc .find(misc ).applyTo(&paint);
291 fStroke.find(stroke).applyTo(&paint); 320 fStroke.find(stroke).applyTo(&paint);
292 fCanvas->drawPath(fPath.find(path), paint); 321 fCanvas->drawPath(fPath.find(path), paint);
293 } 322 }
294 323
295 } // namespace SkRemote 324 } // namespace SkRemote
OLDNEW
« no previous file with comments | « src/core/SkRemote.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698