[go: nahoru, domu]

[3/5] Add translated rasterization support for RasterBuffer & below

This CL implements the muscle of transformed rasterization. RasterBuffer now
accepts a translation in addition to a scale factor when rasterizing into a
backing.

Arbitrary raster transformation is not planned for near future. Thus only
implementing scale & translate which already helps many common cases.

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2563743004
Cr-Commit-Position: refs/heads/master@{#461673}
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index 1cc36f18..de489ff 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -34,7 +34,7 @@
     const gfx::Size& resource_size,
     const gfx::Rect& raster_full_rect,
     const gfx::Rect& raster_dirty_rect,
-    float scale,
+    const gfx::AxisTransform2d& transform,
     const RasterSource::PlaybackSettings& playback_settings,
     ContextProvider* context_provider,
     ResourceProvider::ScopedWriteLockGL* resource_lock,
@@ -79,7 +79,7 @@
 
   raster_source->PlaybackToCanvas(
       sk_surface->getCanvas(), resource_lock->color_space_for_raster(),
-      raster_full_rect, playback_rect, scale, playback_settings);
+      raster_full_rect, playback_rect, transform, playback_settings);
 }
 
 }  // namespace
@@ -105,13 +105,13 @@
     const gfx::Rect& raster_full_rect,
     const gfx::Rect& raster_dirty_rect,
     uint64_t new_content_id,
-    float scale,
+    const gfx::AxisTransform2d& transform,
     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);
+                                  new_content_id, transform, playback_settings);
 }
 
 GpuRasterBufferProvider::GpuRasterBufferProvider(
@@ -252,7 +252,7 @@
     const gfx::Rect& raster_full_rect,
     const gfx::Rect& raster_dirty_rect,
     uint64_t new_content_id,
-    float scale,
+    const gfx::AxisTransform2d& transform,
     const RasterSource::PlaybackSettings& playback_settings) {
   ContextProvider::ScopedContextLock scoped_context(worker_context_provider_);
   gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL();
@@ -269,7 +269,7 @@
 
   RasterizeSource(raster_source, resource_has_previous_content,
                   resource_lock->size(), raster_full_rect, raster_dirty_rect,
-                  scale, playback_settings, worker_context_provider_,
+                  transform, playback_settings, worker_context_provider_,
                   resource_lock, async_worker_context_enabled_,
                   use_distance_field_text_, msaa_sample_count_);