Reenable NullOpenerRedirectForksProcess, as the offending patch has been reverted
[chromium-blink-merge.git] / cc / image_layer_updater.cc
blob8f97359148071983e85012be66a8accc1a9c4815
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/image_layer_updater.h"
6 #include "cc/resource_update_queue.h"
8 namespace cc {
10 void ImageLayerUpdater::Resource::update(ResourceUpdateQueue& queue, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&)
12 m_updater->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate);
15 // static
16 scoped_refptr<ImageLayerUpdater> ImageLayerUpdater::create()
18 return make_scoped_refptr(new ImageLayerUpdater());
21 scoped_ptr<LayerUpdater::Resource> ImageLayerUpdater::createResource(
22 PrioritizedResourceManager* manager)
24 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedResource::create(manager)));
27 void ImageLayerUpdater::updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate)
29 // Source rect should never go outside the image pixels, even if this
30 // is requested because the texture extends outside the image.
31 gfx::Rect clippedSourceRect = sourceRect;
32 gfx::Rect imageRect = gfx::Rect(0, 0, m_bitmap.width(), m_bitmap.height());
33 clippedSourceRect.Intersect(imageRect);
35 gfx::Vector2d clippedDestOffset = destOffset + gfx::Vector2d(clippedSourceRect.origin() - sourceRect.origin());
37 ResourceUpdate upload = ResourceUpdate::Create(texture,
38 &m_bitmap,
39 imageRect,
40 clippedSourceRect,
41 clippedDestOffset);
42 if (partialUpdate)
43 queue.appendPartialUpload(upload);
44 else
45 queue.appendFullUpload(upload);
48 void ImageLayerUpdater::setBitmap(const SkBitmap& bitmap)
50 m_bitmap = bitmap;