aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrLayerHoister.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-12-02 19:40:18 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-02 19:40:18 -0800
commitaf641a1c10f176cb9617026d3cc93c117a85d13d (patch)
treed655e0b8250823136d12be8ac638f5b5c9208fdb /src/gpu/GrLayerHoister.cpp
parent1962f521a239a86417509c0628a99ac0b5ba0bc2 (diff)
Revert "Change clear() to respect the clip"
Diffstat (limited to 'src/gpu/GrLayerHoister.cpp')
-rw-r--r--src/gpu/GrLayerHoister.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index e29e57e8a5..4e7836830c 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -234,6 +234,10 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
SkCanvas* atlasCanvas = surface->getCanvas();
+ SkPaint clearPaint;
+ clearPaint.setColor(SK_ColorTRANSPARENT);
+ clearPaint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode))->unref();
+
for (int i = 0; i < atlased.count(); ++i) {
const GrCachedLayer* layer = atlased[i].fLayer;
const SkPicture* pict = atlased[i].fPicture;
@@ -251,7 +255,9 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
SkIntToScalar(layer->rect().width()),
SkIntToScalar(layer->rect().height()));
atlasCanvas->clipRect(bound);
- atlasCanvas->clear(0);
+
+ // Since 'clear' doesn't respect the clip we need to draw a rect
+ atlasCanvas->drawRect(bound, clearPaint);
// '-offset' maps the layer's top/left to the origin.
// Since this layer is atlased, the top/left corner needs
@@ -266,7 +272,7 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
SkRecordPartialDraw(*pict->fRecord.get(), atlasCanvas,
pict->drawablePicts(), pict->drawableCount(),
- layer->start() + 1, layer->stop(), initialCTM);
+ bound, layer->start() + 1, layer->stop(), initialCTM);
atlasCanvas->restore();
}
@@ -297,6 +303,7 @@ void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
SkIntToScalar(layer->rect().height()));
layerCanvas->clipRect(bound);
+
layerCanvas->clear(SK_ColorTRANSPARENT);
SkMatrix initialCTM;
@@ -308,7 +315,7 @@ void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
SkRecordPartialDraw(*pict->fRecord.get(), layerCanvas,
pict->drawablePicts(), pict->drawableCount(),
- layer->start()+1, layer->stop(), initialCTM);
+ bound, layer->start()+1, layer->stop(), initialCTM);
layerCanvas->flush();
}