summaryrefslogtreecommitdiffstats
path: root/ui/gfx/canvas.cc
Commit message (Collapse)AuthorAgeFilesLines
* ui: Use skia::RefPtr<T> for implicit safe reference counting.danakj@chromium.org2012-12-051-29/+30
| | | | | | | | | | | R=sky BUG=163454 Depends on: https://codereview.chromium.org/11418217/ NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11299262 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171107 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify platform_canvas.h by recognizing that PlatformCanvas does not ↵reed@google.com2012-11-141-8/+8
| | | | | | | | | | | | | | | | | | | | | actually extend SkCanvas in any way, other than provide a host of constructors (and delayed constructors in the form of 'initialize' methods). These late initializers are a problem, as SkCanvas is deprecating its setDevice() call, moving to model where the backingstore/device for the canvas must be created before the canvas is created. This is necessary to allow skia to continue to extend SkCanvas for its backends (e.g. GPU, PDF, Picture, Pipe, etc.). The practical change in this CL is to make PlatformCanvas just a typedef for SkCanvas, and change the call-sites that want to call initialize() to instead create the canvas using one of the provided Factory functions (e.g. CreatePlatformCanvas). The modifier Platform is maintained, to document that this canvas may be backed by platform-specific pixels (e.g. allocated by GDI or cairo). Review URL: https://codereview.chromium.org/11138024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167669 0039d316-1c4b-4281-b951-d872f2087c98
* ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar ↵danakj@chromium.org2012-11-101-3/+3
| | | | | | | | | | | | | | to Rect/Point. Covered by existing unit tests. R=sky BUG=160158 Review URL: https://chromiumcodereview.appspot.com/11377068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167077 0039d316-1c4b-4281-b951-d872f2087c98
* Add Vector2d classes that represent offsets, instead of using Point.danakj@chromium.org2012-10-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously Point served two purposes, to be a position in 2d space, and also an offset from the origin. This introduces a Vector2d class to represent an offset, allowing typesafety checks for geometric operations. The following are now the case: Point +/- Vector = Point - A point plus/minus an offset gives you a point at a position offset by the vector. Vector +/- Vector = Vector - Two offsets can be added together to make a new offset. Point - Point = Vector - Subtracting one point from another gives you the offset between the two points. We add some new methods to perform these operations: Rect::OffsetFromOrigin() gives the offset between the position of the rect and the origin. Point::OffsetFromOrigin() gives the offset between the point and the origin. PointAtOffsetFromOrigin(Vector2d) converts a Vector2d to a Point at the given offset away from the origin. Rect::Offset(), Point::Add(), and Point::Subtract() now receive a Vector2d instead of a point. BUG=147395 R=sky Review URL: https://codereview.chromium.org/11269022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165198 0039d316-1c4b-4281-b951-d872f2087c98
* Migrate ui::Transform to gfx::Transform shawnsingh@chromium.org2012-10-141-1/+1
| | | | | | | | | | It is more appropriate for Transform class to belong with its fellow geometry classes in the gfx namespace. Review URL: https://chromiumcodereview.appspot.com/11145005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161809 0039d316-1c4b-4281-b951-d872f2087c98
* Remove implicit flooring Scale() method from Point and Size.danakj@chromium.org2012-10-091-2/+5
| | | | | | | | | | | | | | | | | | When scaling an integer point or size, return a floating point result. Implicitly flooring hides design problems and bugs. Add conversion functions to floor or ceil a SizeF or PointF into an integer format again. All existing behaviour has been preserved by replacing uses of foo.Scale() with ToFlooredFoo(foo.Scale()). R=sky BUG=147395 Review URL: https://chromiumcodereview.appspot.com/11081007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160970 0039d316-1c4b-4281-b951-d872f2087c98
* Extend gfx::canvas to allow DrawBitmapInt(..., alpha). This allows callers toreed@google.com2012-10-031-0/+6
| | | | | | | | | | | | | specify an alpha directly, rather than forcing them to bracket the call with SaveLayerAlpha(alpha) DrawBitmapInt() Restore() Should be 2x faster or better. Review URL: https://codereview.chromium.org/11046020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159948 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup gfx::Canvas now that 10562027 has landedpkotwicz@chromium.org2012-07-241-49/+29
| | | | | | | | | | | Bug=None Test=Compiles on Mac and CrOS R=oshima,sky TBR=sadrul,sail Review URL: https://chromiumcodereview.appspot.com/10701063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148123 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 147915 - Cleanup gfx::Canvas now that 10562027 has landedacolwell@chromium.org2012-07-231-29/+49
| | | | | | | | | | | | | | | | Reverting because composite_unittests were failing on Linux (aura) and Linux ChromeOS Tests bots. Bug=None Test=Compiles on Mac and CrOS R=oshima,sky TBR=sadrul,sail Review URL: https://chromiumcodereview.appspot.com/10701063 TBR=pkotwicz@chromium.org Review URL: https://chromiumcodereview.appspot.com/10790128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147936 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup gfx::Canvas now that 10562027 has landedpkotwicz@chromium.org2012-07-231-49/+29
| | | | | | | | | | | Bug=None Test=Compiles on Mac and CrOS R=oshima,sky TBR=sadrul,sail Review URL: https://chromiumcodereview.appspot.com/10701063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147915 0039d316-1c4b-4281-b951-d872f2087c98
* Adds factory method to create Bitmap shader which displays correctly in High DPIpkotwicz@chromium.org2012-07-021-50/+58
| | | | | | | | | | | | | | | | Added DrawImageInPath to Canvas API. BUG=None TEST=Manual Test Steps: Change the resize code in tray_user to properly resize based on scale factor (See TODO) Run with --force-device-scale-factor=2 --load-2x-resources Ensure that tray user avatars are not blurry Review URL: https://chromiumcodereview.appspot.com/10720003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145176 0039d316-1c4b-4281-b951-d872f2087c98
* Add ability to build a canvas with a target scale factor.pkotwicz@chromium.org2012-06-271-17/+71
| | | | | | | | | | | | | | This allows ExtractBitmap() to return an ImageSkiaRep. This simplifies code around using intermediate bitmaps a lot. BUG=131475 TEST=Compiles R=oshima,sky TBR=sadrul Review URL: https://chromiumcodereview.appspot.com/10562027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144489 0039d316-1c4b-4281-b951-d872f2087c98
* This CL adds a new object: ImageSkiaReppkotwicz@chromium.org2012-06-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | The object represents an SkBitmap and the scale factor that it is painted at. The CL also changes the ImageSkia API to use ui::ScaleFactor instead of floats. In Chromium, having this object is useful because it makes extracting an SkBitmap from an ImageSkia object and packing it back into an ImageSkia object easier. In particular, this makes: float scale_factor; SkBitmap bitmap = input_image->GetBitmapForScale(1.0f, &scale_factor); // do some work with the bitmap gfx::ImageSkia output_image(bitmap, scale_factor); into gfx::ImageSkiaRep image_rep = input_image->GetRepresentation(ui::SCALE_FACTOR_100P); // do some work with the image_rep gfx::ImageSkia output_image(image_rep); R=sky TBR=sadrul for chrome/browser/chromeos/status Review URL: https://chromiumcodereview.appspot.com/10448070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143940 0039d316-1c4b-4281-b951-d872f2087c98
* Rename DrawBitmapInt to DrawImageIntpkotwicz@chromium.org2012-06-071-17/+17
| | | | | | | | | | | Bug=None Test=Compiles Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=140877 Review URL: https://chromiumcodereview.appspot.com/10512021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141002 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 140877 - Rename DrawBitmapInt to DrawImageIntpkotwicz@chromium.org2012-06-061-17/+17
| | | | | | | | | | | | Bug=None Test=Compiles Review URL: https://chromiumcodereview.appspot.com/10512021 TBR=pkotwicz@chromium.org Review URL: https://chromiumcodereview.appspot.com/10546037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140882 0039d316-1c4b-4281-b951-d872f2087c98
* Rename DrawBitmapInt to DrawImageIntpkotwicz@chromium.org2012-06-061-17/+17
| | | | | | | | | Bug=None Test=Compiles Review URL: https://chromiumcodereview.appspot.com/10512021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140877 0039d316-1c4b-4281-b951-d872f2087c98
* Update std::vector<ShadowValue> to ShadowValues.xiyuan@chromium.org2012-05-291-2/+1
| | | | | | | | | | | This is a follow-up clean up for http://crrev.com/139162. BUG=none. TEST=none. Review URL: https://chromiumcodereview.appspot.com/10453057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139412 0039d316-1c4b-4281-b951-d872f2087c98
* Fix leak. unref shader after use.oshima@chromium.org2012-05-261-0/+1
| | | | | | | | | | | TBR=pkotwicz@chromium.org, BUG=none TEST=heapchecker bot will cycle green Review URL: https://chromiumcodereview.appspot.com/10441058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139199 0039d316-1c4b-4281-b951-d872f2087c98
* native_theme_base/android had copied and pasted versions of DrawBitmapInt ↵pkotwicz@chromium.org2012-05-251-13/+30
| | | | | | | | | | | | | | | | and TileImageInt. Made these two files use the version inside of Canvas. Also fixed hidden bug in ::DrawTiledImage where src_x and src_y translates are applied after the tile scale instead of before. This bug is hidden as neither native_theme_base/android called DrawTiledImage with src_x/src_y != 0. Bug=124566 Test=Webkit fast/* layout tests produce no image diffs Review URL: https://chromiumcodereview.appspot.com/10452035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139149 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes regressions in canvas due to 10245003pkotwicz@chromium.org2012-05-231-2/+3
| | | | | | | | | BUG=128951 TEST=Manual Review URL: https://chromiumcodereview.appspot.com/10417041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138528 0039d316-1c4b-4281-b951-d872f2087c98
* This patch makes ImageSkia more like SkBitmap. The goal is to make swapping ↵pkotwicz@chromium.org2012-05-161-31/+76
| | | | | | | | | | | | | from SkBitmap to ImageSkia easier. Notable changes: - ImageSkia can be cheaply copied - Added extractSubset, will remove after SkBitmaps have been converted to ImageSkia - Modified API to look more like SkBitmap Review URL: https://chromiumcodereview.appspot.com/10245003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137520 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 136332 - This patch makes ImageSkia more like SkBitmap. The goal is ↵pkotwicz@chromium.org2012-05-141-76/+31
| | | | | | | | | | | | | | | | | | to make swapping from SkBitmap to ImageSkia easier. Notable changes: - ImageSkia can be cheaply copied - Added extractSubset, will remove after SkBitmaps have been converted to ImageSkia - Modified API to look more like SkBitmap Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=136304 Review URL: https://chromiumcodereview.appspot.com/10245003 TBR=pkotwicz@chromium.org Review URL: https://chromiumcodereview.appspot.com/10389132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136995 0039d316-1c4b-4281-b951-d872f2087c98
* This patch makes ImageSkia more like SkBitmap. The goal is to make swapping ↵pkotwicz@chromium.org2012-05-101-31/+76
| | | | | | | | | | | | | | | from SkBitmap to ImageSkia easier. Notable changes: - ImageSkia can be cheaply copied - Added extractSubset, will remove after SkBitmaps have been converted to ImageSkia - Modified API to look more like SkBitmap Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=136304 Review URL: https://chromiumcodereview.appspot.com/10245003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136332 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 136304 - This patch makes ImageSkia more like SkBitmap. The goal is ↵pkotwicz@chromium.org2012-05-101-76/+31
| | | | | | | | | | | | | | | | to make swapping from SkBitmap to ImageSkia easier. Notable changes: - ImageSkia can be cheaply copied - Added extractSubset, will remove after SkBitmaps have been converted to ImageSkia - Modified API to look more like SkBitmap Review URL: https://chromiumcodereview.appspot.com/10245003 TBR=pkotwicz@chromium.org Review URL: https://chromiumcodereview.appspot.com/10383110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136313 0039d316-1c4b-4281-b951-d872f2087c98
* This patch makes ImageSkia more like SkBitmap. The goal is to make swapping ↵pkotwicz@chromium.org2012-05-101-31/+76
| | | | | | | | | | | | | from SkBitmap to ImageSkia easier. Notable changes: - ImageSkia can be cheaply copied - Added extractSubset, will remove after SkBitmaps have been converted to ImageSkia - Modified API to look more like SkBitmap Review URL: https://chromiumcodereview.appspot.com/10245003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136304 0039d316-1c4b-4281-b951-d872f2087c98
* On the Mac, we populate NSImage from bitmaps in resource bundles. Introduce ↵pkotwicz@chromium.org2012-04-241-8/+20
| | | | | | | | | | | | | ImageSkia which contains vector of SkBitmaps. Previously this functionality was within ImageRepSkia. ImageSkia exposes this. Move gfx::Image::GetSkBitmapAtIndex and gfx::Image::GetNumSkBitmaps to ImageSkia BUG=122992 TEST=None Review URL: http://codereview.chromium.org/10086023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133607 0039d316-1c4b-4281-b951-d872f2087c98
* ash: Better and faster text shadows.xiyuan@chromium.org2012-04-111-0/+19
| | | | | | | | | | | | | | | - Add a DrawStringWithShadows that draws text with shadows to canvas skia and RenderText; - Use DrawStringWithShadows in DropShadowLabel for better and faster text shadows; BUG=121694 TEST=Verify fix for issue 121694. Review URL: http://codereview.chromium.org/10008027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131696 0039d316-1c4b-4281-b951-d872f2087c98
* Add to gfx::Canvas API so that views doesn't use SkCanvas directly.pkotwicz@chromium.org2012-04-091-0/+47
| | | | | | | | | Bug=114665 Test=Compiles Review URL: http://codereview.chromium.org/9949067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131474 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Do not pass SkColor by const-reference as it's defined as POD(integer).tfarina@chromium.org2012-03-241-7/+7
| | | | | | | | | BUG=100898 R=asvitkine@chromium.org Review URL: https://chromiumcodereview.appspot.com/9838089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128782 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Kill Canvas::FillRect() function that takes gfx::Brush.tfarina@chromium.org2012-03-171-33/+0
| | | | | | | | | | BUG=100898 R=pkasting@chromium.org TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/9718014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127376 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Fix the file names of "canvas_skia_*" to say just "canvas_platform".tfarina@chromium.org2012-03-171-0/+378
| | | | | | | | | | BUG=116572 R=asvitkine@chromium.org TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/9719018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127369 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Clean up the remaining references to CanvasSkia.tfarina@chromium.org2012-03-171-25/+0
| | | | | | | | | | BUG=116572 R=asvitkine@chromium.org TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/9704096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127307 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia.tfarina@chromium.org2012-03-091-9/+9
| | | | | | | | | | | | The final goal is to merge these two classes into a single gfx::Canvas class. BUG=116572 R=ben@chromium.org,asvitkine@chromium.org TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/9562038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125735 0039d316-1c4b-4281-b951-d872f2087c98
* ui/gfx: Convert Canvas::TranslateInt() to use gfx::Point.tfarina@chromium.org2011-10-271-1/+1
| | | | | | | | | BUG=100898 R=pkasting@chromium.org Review URL: http://codereview.chromium.org/8390037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107483 0039d316-1c4b-4281-b951-d872f2087c98
* Allow CanvasSkia to bind to an existing SkCanvas.piman@chromium.org2011-10-051-1/+9
| | | | | | | | | | BUG=None TEST=None Review URL: http://codereview.chromium.org/8122013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104146 0039d316-1c4b-4281-b951-d872f2087c98
* Change includes of gfx/* to ui/gfx/*sail@chromium.org2011-02-051-1/+1
| | | | | | | | | BUG=71063 TEST=compiled Review URL: http://codereview.chromium.org/6312156 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73890 0039d316-1c4b-4281-b951-d872f2087c98
* Move src/gfx/ to src/ui/gfxsail@chromium.org2011-02-021-0/+17
To reduce the size of this change I've left stub header files in src/gfx/. Once all includes have been updated I'll delete the stub files. BUG=71063 TEST=Still doing test builds. Review URL: http://codereview.chromium.org/6246027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73530 0039d316-1c4b-4281-b951-d872f2087c98