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

Unified Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2175553002: Raster PictureLayerTiling with fractional translation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Raster PictureLayerTiling with fractional translation Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/raster/gpu_raster_buffer_provider.cc
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index f4eadee502105419071aa77d8fdf221b9cd64e9b..1d8291c55c06128e3fadb50d93c2bb8ee9b79f50 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -33,6 +33,7 @@ static sk_sp<SkPicture> PlaybackToPicture(
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
float scale,
+ const gfx::Vector2dF& translation,
const RasterSource::PlaybackSettings& playback_settings) {
// GPU raster doesn't do low res tiles, so should always include images.
DCHECK(!playback_settings.skip_images);
@@ -63,6 +64,10 @@ static sk_sp<SkPicture> PlaybackToPicture(
sk_sp<SkCanvas> canvas = sk_ref_sp(
recorder.beginRecording(resource_size.width(), resource_size.height()));
canvas->save();
+ canvas->translate(-raster_full_rect.x(), -raster_full_rect.y());
+ canvas->clipRect(gfx::RectToSkRect(playback_rect));
+ canvas->translate(translation.x(), translation.y());
+ canvas->scale(scale, scale);
// The GPU image decode controller assumes that Skia is done with an image
// when playback is complete. However, in this case, where we play back to a
@@ -73,8 +78,7 @@ static sk_sp<SkPicture> PlaybackToPicture(
// later picture rasterization.
RasterSource::PlaybackSettings settings = playback_settings;
settings.use_image_hijack_canvas = false;
- raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect,
- scale, settings);
+ raster_source->PlaybackToCanvas(canvas.get(), settings);
canvas->restore();
return recorder.finishRecordingAsPicture();
}
@@ -147,12 +151,13 @@ void GpuRasterBufferProvider::RasterBufferImpl::Playback(
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
float scale,
+ const gfx::Vector2dF& translation,
const RasterSource::PlaybackSettings& playback_settings) {
TRACE_EVENT0("cc", "GpuRasterBuffer::Playback");
- client_->PlaybackOnWorkerThread(&lock_, sync_token_,
- resource_has_previous_content_, raster_source,
- raster_full_rect, raster_dirty_rect,
- new_content_id, scale, playback_settings);
+ client_->PlaybackOnWorkerThread(
+ &lock_, sync_token_, resource_has_previous_content_, raster_source,
+ raster_full_rect, raster_dirty_rect, new_content_id, scale, translation,
+ playback_settings);
}
GpuRasterBufferProvider::GpuRasterBufferProvider(
@@ -245,6 +250,7 @@ void GpuRasterBufferProvider::PlaybackOnWorkerThread(
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
float scale,
+ const gfx::Vector2dF& translation,
const RasterSource::PlaybackSettings& playback_settings) {
ContextProvider::ScopedContextLock scoped_context(worker_context_provider_);
gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL();
@@ -261,7 +267,8 @@ void GpuRasterBufferProvider::PlaybackOnWorkerThread(
sk_sp<SkPicture> picture = PlaybackToPicture(
raster_source, resource_has_previous_content, resource_lock->size(),
- raster_full_rect, raster_dirty_rect, scale, playback_settings);
+ raster_full_rect, raster_dirty_rect, scale, translation,
+ playback_settings);
// Turn on distance fields for layers that have ever animated.
bool use_distance_field_text =

Powered by Google App Engine
This is Rietveld 408576698