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

Side by Side Diff: sky/engine/platform/graphics/filters/SourceGraphic.cpp

Issue 1017593005: Add a basic custom painting facility to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files Created 5 years, 9 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 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (!resultImage || !filter->sourceImage()) 56 if (!resultImage || !filter->sourceImage())
57 return; 57 return;
58 58
59 IntRect srcRect = filter->sourceImageRect(); 59 IntRect srcRect = filter->sourceImageRect();
60 if (ImageBuffer* sourceImageBuffer = filter->sourceImage()) { 60 if (ImageBuffer* sourceImageBuffer = filter->sourceImage()) {
61 resultImage->context()->drawImageBuffer(sourceImageBuffer, 61 resultImage->context()->drawImageBuffer(sourceImageBuffer,
62 FloatRect(IntPoint(srcRect.location() - absolutePaintRect().location ()), sourceImageBuffer->size())); 62 FloatRect(IntPoint(srcRect.location() - absolutePaintRect().location ()), sourceImageBuffer->size()));
63 } 63 }
64 } 64 }
65 65
66 void SourceGraphic::setDisplayList(PassRefPtr<DisplayList> displayList)
67 {
68 m_displayList = displayList;
69 }
70
71 PassRefPtr<SkImageFilter> SourceGraphic::createImageFilter(SkiaImageFilterBuilde r*) 66 PassRefPtr<SkImageFilter> SourceGraphic::createImageFilter(SkiaImageFilterBuilde r*)
72 { 67 {
73 if (!m_displayList) 68 return nullptr;
74 return nullptr;
75
76 return adoptRef(SkPictureImageFilter::Create(m_displayList->picture(), m_dis playList->bounds()));
77 } 69 }
78 70
79 TextStream& SourceGraphic::externalRepresentation(TextStream& ts, int indent) co nst 71 TextStream& SourceGraphic::externalRepresentation(TextStream& ts, int indent) co nst
80 { 72 {
81 writeIndent(ts, indent); 73 writeIndent(ts, indent);
82 ts << "[SourceGraphic]\n"; 74 ts << "[SourceGraphic]\n";
83 return ts; 75 return ts;
84 } 76 }
85 77
86 } // namespace blink 78 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698