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

Side by Side Diff: src/core/SkLiteDL.cpp.orig

Issue 2224163005: Made shadows blurry (thru implementing variance mapping) (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: rebased off master again! Created 4 years, 3 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 /*
robertphillips 2016/08/23 17:19:40 delete this file
vjiaoblack 2016/08/23 18:01:22 Done.
vjiaoblack 2016/08/23 18:01:22 Done.
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkImageFilter.h" 10 #include "SkImageFilter.h"
11 #include "SkLiteDL.h" 11 #include "SkLiteDL.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 sk_sp<const SkPicture> picture; 262 sk_sp<const SkPicture> picture;
263 SkMatrix matrix = SkMatrix::I(); 263 SkMatrix matrix = SkMatrix::I();
264 SkPaint paint; 264 SkPaint paint;
265 bool has_paint = false; // TODO: why is a default pai nt not the same? 265 bool has_paint = false; // TODO: why is a default pai nt not the same?
266 void draw(SkCanvas* c, const SkMatrix&) { 266 void draw(SkCanvas* c, const SkMatrix&) {
267 c->drawPicture(picture.get(), &matrix, has_paint ? &paint : nullptr) ; 267 c->drawPicture(picture.get(), &matrix, has_paint ? &paint : nullptr) ;
268 } 268 }
269 void makeThreadsafe() { make_threadsafe(nullptr, &matrix); } 269 void makeThreadsafe() { make_threadsafe(nullptr, &matrix); }
270 }; 270 };
271 struct DrawShadowedPicture final : Op { 271 struct DrawShadowedPicture final : Op {
272 <<<<<<< e4eafaf6385a6ab52989fe9a2685ae1e48e5815c
272 static const auto kType = Type::DrawShadowedPicture; 273 static const auto kType = Type::DrawShadowedPicture;
273 DrawShadowedPicture(const SkPicture* picture, const SkMatrix* matrix, co nst SkPaint* paint) 274 DrawShadowedPicture(const SkPicture* picture, const SkMatrix* matrix, co nst SkPaint* paint)
275 =======
276 DrawShadowedPicture(const SkPicture* picture, const SkMatrix* matrix,
277 const SkPaint* paint, bool blurry)
278 >>>>>>> added biasing
274 : picture(sk_ref_sp(picture)) { 279 : picture(sk_ref_sp(picture)) {
275 if (matrix) { this->matrix = *matrix; } 280 if (matrix) { this->matrix = *matrix; }
276 if (paint) { this->paint = *paint; } 281 if (paint) { this->paint = *paint; }
282 this->blurry = blurry;
277 } 283 }
278 sk_sp<const SkPicture> picture; 284 sk_sp<const SkPicture> picture;
279 SkMatrix matrix = SkMatrix::I(); 285 SkMatrix matrix = SkMatrix::I();
280 SkPaint paint; 286 SkPaint paint;
287 <<<<<<< e4eafaf6385a6ab52989fe9a2685ae1e48e5815c
281 void draw(SkCanvas* c, const SkMatrix&) { 288 void draw(SkCanvas* c, const SkMatrix&) {
289 =======
290 bool blurry;
291 void draw(SkCanvas* c) override {
292 >>>>>>> added biasing
282 #ifdef SK_EXPERIMENTAL_SHADOWING 293 #ifdef SK_EXPERIMENTAL_SHADOWING
283 c->drawShadowedPicture(picture.get(), &matrix, &paint); 294 c->drawShadowedPicture(picture.get(), &matrix, &paint, blurry);
284 #endif 295 #endif
285 } 296 }
286 void makeThreadsafe() { make_threadsafe(nullptr, &matrix); } 297 void makeThreadsafe() { make_threadsafe(nullptr, &matrix); }
287 }; 298 };
288 299
289 struct DrawImage final : Op { 300 struct DrawImage final : Op {
290 static const auto kType = Type::DrawImage; 301 static const auto kType = Type::DrawImage;
291 DrawImage(sk_sp<const SkImage>&& image, SkScalar x, SkScalar y, const Sk Paint* paint) 302 DrawImage(sk_sp<const SkImage>&& image, SkScalar x, SkScalar y, const Sk Paint* paint)
292 : image(std::move(image)), x(x), y(y) { 303 : image(std::move(image)), x(x), y(y) {
293 if (paint) { this->paint = *paint; } 304 if (paint) { this->paint = *paint; }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 void* pod = this->push<DrawAnnotation>(bytes, rect, value); 619 void* pod = this->push<DrawAnnotation>(bytes, rect, value);
609 copy_v(pod, key,bytes); 620 copy_v(pod, key,bytes);
610 } 621 }
611 void SkLiteDL::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix) { 622 void SkLiteDL::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
612 this->push<DrawDrawable>(0, drawable, matrix); 623 this->push<DrawDrawable>(0, drawable, matrix);
613 } 624 }
614 void SkLiteDL::drawPicture(const SkPicture* picture, 625 void SkLiteDL::drawPicture(const SkPicture* picture,
615 const SkMatrix* matrix, const SkPaint* paint) { 626 const SkMatrix* matrix, const SkPaint* paint) {
616 this->push<DrawPicture>(0, picture, matrix, paint); 627 this->push<DrawPicture>(0, picture, matrix, paint);
617 } 628 }
629 <<<<<<< e4eafaf6385a6ab52989fe9a2685ae1e48e5815c
618 void SkLiteDL::drawShadowedPicture(const SkPicture* picture, 630 void SkLiteDL::drawShadowedPicture(const SkPicture* picture,
619 const SkMatrix* matrix, const SkPaint* paint) { 631 const SkMatrix* matrix, const SkPaint* paint) {
620 this->push<DrawShadowedPicture>(0, picture, matrix, paint); 632 this->push<DrawShadowedPicture>(0, picture, matrix, paint);
633 =======
634 void SkLiteDL::drawShadowedPicture(const SkPicture* picture, const SkMatrix* mat rix,
635 const SkPaint* paint, bool blurry) {
636 push<DrawShadowedPicture>(&fBytes, 0, picture, matrix, paint, blurry);
637 >>>>>>> added biasing
621 } 638 }
622 639
623 void SkLiteDL::drawBitmap(const SkBitmap& bm, SkScalar x, SkScalar y, const SkPa int* paint) { 640 void SkLiteDL::drawBitmap(const SkBitmap& bm, SkScalar x, SkScalar y, const SkPa int* paint) {
624 this->push<DrawImage>(0, SkImage::MakeFromBitmap(bm), x,y, paint); 641 this->push<DrawImage>(0, SkImage::MakeFromBitmap(bm), x,y, paint);
625 } 642 }
626 void SkLiteDL::drawBitmapNine(const SkBitmap& bm, const SkIRect& center, 643 void SkLiteDL::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
627 const SkRect& dst, const SkPaint* paint) { 644 const SkRect& dst, const SkPaint* paint) {
628 this->push<DrawImageNine>(0, SkImage::MakeFromBitmap(bm), center, dst, paint ); 645 this->push<DrawImageNine>(0, SkImage::MakeFromBitmap(bm), center, dst, paint );
629 } 646 }
630 void SkLiteDL::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRec t& dst, 647 void SkLiteDL::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRec t& dst,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 } 789 }
773 790
774 void SkLiteDL::reset(SkRect bounds) { 791 void SkLiteDL::reset(SkRect bounds) {
775 SkASSERT(this->unique()); 792 SkASSERT(this->unique());
776 this->map(dtor_fns); 793 this->map(dtor_fns);
777 794
778 // Leave fBytes and fReserved alone. 795 // Leave fBytes and fReserved alone.
779 fUsed = 0; 796 fUsed = 0;
780 fBounds = bounds; 797 fBounds = bounds;
781 } 798 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698