aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmap.cpp
Commit message (Collapse)AuthorAge
* detect null pixles in setPixels() and just clear out any existing pixelref.Gravatar reed@google.com2012-07-30
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4827 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reapply "Remove Bitmaps Raw Pixel Support."Gravatar djsollen@google.com2012-07-27
| | | | | | | | | This CL reapplies r4722. Now that we have addressed the issues in Chrome tests that were causing asserts to be fired. Review URL: https://codereview.appspot.com/6452050 git-svn-id: http://skia.googlecode.com/svn/trunk@4804 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Remove Bitmaps Raw Pixel Support."Gravatar djsollen@google.com2012-07-26
| | | | | | | | | BUG= TEST= Review URL: https://codereview.appspot.com/6449049 git-svn-id: http://skia.googlecode.com/svn/trunk@4780 2bbb7eff-a529-9590-31e7-b0007b416f81
* Prevent MipMaps from crashing.Gravatar bungeman@google.com2012-07-25
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4753 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove Bitmaps Raw Pixel Support.Gravatar djsollen@google.com2012-07-23
| | | | | | | | bitmap.setPixels(...) now creates a mutable pixelRef instead of just setting fPixels. Review URL: https://codereview.appspot.com/6419044 git-svn-id: http://skia.googlecode.com/svn/trunk@4722 2bbb7eff-a529-9590-31e7-b0007b416f81
* Expanded distribution of instance countingGravatar robertphillips@google.com2012-06-21
| | | | | | | | http://codereview.appspot.com/6300114/ git-svn-id: http://skia.googlecode.com/svn/trunk@4291 2bbb7eff-a529-9590-31e7-b0007b416f81
* For SkGPipe, store bitmaps in a common location.Gravatar scroggo@google.com2012-06-13
| | | | | | | | Also make a change to SkBitmap::copyTo() so that we do not crash. Review URL: https://codereview.appspot.com/6296066 git-svn-id: http://skia.googlecode.com/svn/trunk@4249 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move SkColorTable into its own header and reduce includes in SkFlattenable.hGravatar djsollen@google.com2012-06-12
| | | | | | Review URL: https://codereview.appspot.com/6299072 git-svn-id: http://skia.googlecode.com/svn/trunk@4236 2bbb7eff-a529-9590-31e7-b0007b416f81
* Punctuation cleanup to satisfy idiosyncracies of OpenBSD gcc 4.2.1.Gravatar tomhudson@google.com2012-06-01
| | | | | | | | | | Original patch by landry.breuil. http://code.google.com/p/skia/issues/detail?id=626 git-svn-id: http://skia.googlecode.com/svn/trunk@4112 2bbb7eff-a529-9590-31e7-b0007b416f81
* Mutexes in pixelrefs were done very sloppily initially. The code (a) assumes allGravatar reed@google.com2012-05-17
| | | | | | | | | | | | | | | | | | | | pixelref subclasses want a mutex to guard their lock/unlock virtuals, and (b) most subclasses use the same mutex for *all* of their instances, even when there is no explicit need to guard modifying one instances with another. When we try drawing bitmaps from multiple threads, we are seeing a lot of slow- down from these mutexes. This CL has two changes to try to speed things up. 1. Add setPreLocked(), for pixelrefs who never need the onLockPixels virtual to be called. This speeds up those subclasses in multithreaded environs as it avoids the mutex lock all together (e.g. SkMallocPixelRef). 2. Add setMutex() to allow a subclass to change the mutex choice. ashmem wants this, since its unflattening constructor cannot pass down the null, it needs to cleanup afterwards. Review URL: https://codereview.appspot.com/6199075 git-svn-id: http://skia.googlecode.com/svn/trunk@3985 2bbb7eff-a529-9590-31e7-b0007b416f81
* Consolidate PixelRef flattables with the standard implGravatar djsollen@google.com2012-03-28
| | | | | | | | | | The flatten method on these functions can no longer be const as SkFlattenables declaration is not const and would result in the const methods only being called when the reference to the object was const. Review URL: https://codereview.appspot.com/5941043 git-svn-id: http://skia.googlecode.com/svn/trunk@3533 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make use of the functions in the flattenable reader/writerGravatar djsollen@google.com2012-03-26
| | | | | | Review URL: https://codereview.appspot.com/5905066 git-svn-id: http://skia.googlecode.com/svn/trunk@3493 2bbb7eff-a529-9590-31e7-b0007b416f81
* add IRect variant of getBounds()Gravatar reed@google.com2012-03-16
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3414 2bbb7eff-a529-9590-31e7-b0007b416f81
* add getBounds() helperGravatar reed@google.com2012-03-15
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3409 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r3036. This change breaks loading images asGravatar caryclark@google.com2012-02-17
| | | | | | | | | described in Chromium issue 114107. The Chromium break may be fixed by WebKit patch 78239, at which time this patch can be reapplied. Review URL: https://codereview.appspot.com/5675077 git-svn-id: http://skia.googlecode.com/svn/trunk@3219 2bbb7eff-a529-9590-31e7-b0007b416f81
* Modify SkBitmap::extractSubset() to respect volatilityGravatar skyostil@google.com2012-01-16
| | | | | | | | | | The resulting subset bitmap will always have the same volatility flag as the source bitmap. BUG=452 Review URL: http://codereview.appspot.com/5544052 git-svn-id: http://skia.googlecode.com/svn/trunk@3039 2bbb7eff-a529-9590-31e7-b0007b416f81
* Modify SkBitmap::extractSubset() to respect opaquenessGravatar skyostil@google.com2012-01-13
| | | | | | | | | | The resulting subset bitmap will always have the same opaqueness flag as the source bitmap. BUG=439 Review URL: http://codereview.appspot.com/5534051 git-svn-id: http://skia.googlecode.com/svn/trunk@3036 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkDEBUGFAIL to clean up use of SkASSERT(!"text");Gravatar tomhudson@google.com2011-12-28
| | | | | | | | | | catch a couple of latent SkASSERT("text") bugs. http://codereview.appspot.com/5504090/ git-svn-id: http://skia.googlecode.com/svn/trunk@2926 2bbb7eff-a529-9590-31e7-b0007b416f81
* Exposing the isImmutable/setImmutable API of SkPixelRef in SkBitmapGravatar junov@chromium.org2011-12-15
| | | | | | | | REVIEW=http://codereview.appspot.com/5491055/ git-svn-id: http://skia.googlecode.com/svn/trunk@2883 2bbb7eff-a529-9590-31e7-b0007b416f81
* When a bitmap is texture-backed, change SkBitmap::copyTo() to do a deepGravatar senorblanco@chromium.org2011-12-02
| | | | | | | | | | | copy of the texels in VRAM rather than a readback and re-upload. This gives a 3-10X speedup on recursive canvas-to-canvas draws. N.B.: This introduces a new GM test, which will need new baselines. git-svn-id: http://skia.googlecode.com/svn/trunk@2790 2bbb7eff-a529-9590-31e7-b0007b416f81
* Recommit r2584 with gpu pass of the new ReadPixels test disabled in fixed pt ↵Gravatar bsalomon@google.com2011-11-02
| | | | | | (gpu code doesn't work in general in fixed pt). git-svn-id: http://skia.googlecode.com/svn/trunk@2586 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r2584 (new test fails in fixed pt builds)Gravatar bsalomon@google.com2011-11-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2585 2bbb7eff-a529-9590-31e7-b0007b416f81
* Changes the SkCanvas::readPixels API. Allows caller to read into prealloced ↵Gravatar bsalomon@google.com2011-11-02
| | | | | | | | | | bitmap pixels. Changes how clipping to device bounds is handled. Review URL: http://codereview.appspot.com/5307077/ git-svn-id: http://skia.googlecode.com/svn/trunk@2584 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove unused copyPixelsFrom ... (copyPixelsTo is next on the chopping block)Gravatar reed@google.com2011-11-01
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2579 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change SkAutoMaskImage so that we're less likely to write leaky code.Gravatar bungeman@google.com2011-10-04
| | | | | | | http://codereview.appspot.com/5180047/ git-svn-id: http://skia.googlecode.com/svn/trunk@2409 2bbb7eff-a529-9590-31e7-b0007b416f81
* Automatic update of all copyright notices to reflect new license terms.Gravatar epoger@google.com2011-07-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have manually examined all of these diffs and restored a few files that seem to require manual adjustment. The following files still need to be modified manually, in a separate CL: android_sample/SampleApp/AndroidManifest.xml android_sample/SampleApp/res/layout/layout.xml android_sample/SampleApp/res/menu/sample.xml android_sample/SampleApp/res/values/strings.xml android_sample/SampleApp/src/com/skia/sampleapp/SampleApp.java android_sample/SampleApp/src/com/skia/sampleapp/SampleView.java experimental/CiCarbonSampleMain.c experimental/CocoaDebugger/main.m experimental/FileReaderApp/main.m experimental/SimpleCocoaApp/main.m experimental/iOSSampleApp/Shared/SkAlertPrompt.h experimental/iOSSampleApp/Shared/SkAlertPrompt.m experimental/iOSSampleApp/SkiOSSampleApp-Base.xcconfig experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig gpu/src/android/GrGLDefaultInterface_android.cpp gyp/common.gypi gyp_skia include/ports/SkHarfBuzzFont.h include/views/SkOSWindow_wxwidgets.h make.bat make.py src/opts/memset.arm.S src/opts/memset16_neon.S src/opts/memset32_neon.S src/opts/opts_check_arm.cpp src/ports/SkDebug_brew.cpp src/ports/SkMemory_brew.cpp src/ports/SkOSFile_brew.cpp src/ports/SkXMLParser_empty.cpp src/utils/ios/SkImageDecoder_iOS.mm src/utils/ios/SkOSFile_iOS.mm src/utils/ios/SkStream_NSData.mm tests/FillPathTest.cpp Review URL: http://codereview.appspot.com/4816058 git-svn-id: http://skia.googlecode.com/svn/trunk@1982 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow texture-backed bitmaps to perform a read-back when lockPixels is called.Gravatar reed@google.com2011-07-07
| | | | | | | | | | This means we have to be even more cautious about when we call lock, and we should always check getTexture() first if we can handle a texture directly, rather than forcing the read-back to get the bits. git-svn-id: http://skia.googlecode.com/svn/trunk@1815 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adding the notion of a volatile bitmap to SkBitmap. Gravatar junov@google.com2011-06-30
| | | | | | | | | | | | | | | | | Volatility is a hint that indicates that the contents of a bitmap are ephemeral. SkGpuDevice will not preserve volatile bitmaps in its texture cache, and will use textures from a pool of keyless (recyclable) textures to avoid the performance hit of texture allocation and release. A subsequent change is required in webkit in order to take advantage of this optimization. putImageData, and other methods that create temporary bitmaps will have to mark their bitmaps as volatile. before rendering them through skia. git-svn-id: http://skia.googlecode.com/svn/trunk@1769 2bbb7eff-a529-9590-31e7-b0007b416f81
* Increase compatibility with clang, mostly around SK_RESTRICT.Gravatar tomhudson@google.com2011-06-15
| | | | | | | | Attempting to fix up our use of __restrict__ so Chrome can enable it. git-svn-id: http://skia.googlecode.com/svn/trunk@1597 2bbb7eff-a529-9590-31e7-b0007b416f81
* update doxGravatar reed@google.com2011-04-29
| | | | | | | | code style git-svn-id: http://skia.googlecode.com/svn/trunk@1215 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add genID for SkBitmaps with raw pixelsGravatar bsalomon@google.com2011-04-14
| | | | | | | | Review URL: http://codereview.appspot.com/4413047/ git-svn-id: http://skia.googlecode.com/svn/trunk@1125 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adds read pixels to GrTexture and GrRenderTargetGravatar bsalomon@google.com2011-04-05
| | | | | | | | | Adds SkGrRenderTargetPixelRef for SkBitmaps that are backed by RTs that aren't textures. Adds onReadPixels implementations for SkGr pixel ref types git-svn-id: http://skia.googlecode.com/svn/trunk@1056 2bbb7eff-a529-9590-31e7-b0007b416f81
* add pixelref->readPixels()Gravatar reed@google.com2011-04-01
| | | | | | | | unimplemented (for now) on the gpu side git-svn-id: http://skia.googlecode.com/svn/trunk@1037 2bbb7eff-a529-9590-31e7-b0007b416f81
* Upstreaming changes from android.Gravatar djsollen@google.com2011-03-14
| | | | | | | | | | - fix compile warnings in the GPU code - upstream android specific code (ifdef protected) - fail gracefully when a custom allocator fails git-svn-id: http://skia.googlecode.com/svn/trunk@936 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkBitmap::getColor(int x, int y) - return the color of a pixel in a bitmap.Gravatar vandebo@chromium.org2011-02-24
| | | | | | Review URL: http://codereview.appspot.com/4230041 git-svn-id: http://skia.googlecode.com/svn/trunk@854 2bbb7eff-a529-9590-31e7-b0007b416f81
* merge from android tree:Gravatar djsollen@google.com2011-02-23
| | | | | | | | | | | | | - optional parameters added to descriptorProc and allocPixels - clip options to image decoders - check for xfermode in blitter_a8 - UNROLL loops in blitrow reviewed by reed@google.com git-svn-id: http://skia.googlecode.com/svn/trunk@841 2bbb7eff-a529-9590-31e7-b0007b416f81
* Cleanup issues related to SkBitmap getSize()/extractSubset().Gravatar wjmaclean@chromium.org2011-02-22
| | | | | | | | Some minor revisions to do cleanup regarding getSize() and extractSubset(). All are related to avoid read/write past end of the pixel buffer when getSize() is used on a bitmap that is the result of a call to extractSubset(). git-svn-id: http://skia.googlecode.com/svn/trunk@835 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites withGravatar reed@google.com2011-02-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkSafeRef() and SkSafeUnref(). This is basically a bug waiting to happen. An optimizing compiler can remove checks for null on "this" if it chooses. However, SkRefCnt::safeRef() relies on precisely this check... void SkRefCnt::safeRef() { if (this) { this->ref(); } } Since a compiler might skip the if-clause, it breaks the intention of this method, hence its removal. static inline void SkSafeRef(SkRefCnt* obj) { if (obj) { obj->ref(); } } This form is not ignored by an optimizing compile, so we use it instead. git-svn-id: http://skia.googlecode.com/svn/trunk@762 2bbb7eff-a529-9590-31e7-b0007b416f81
* Security fixes re getSize().Gravatar wjmaclean@chromium.org2010-12-22
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@646 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add safe size/copy functions to Skia.Gravatar wjmaclean@chromium.org2010-11-16
| | | | | | | | | | | | | | | | | | | | | | This patch adds four methods to SkBitmap. There are two functions to return "safe size", defined as the number of pixels from the value returned by getPixels() to the end of the allocated buffer. There is one version of fillPixels() to copy the bitmap instance into an external buffer (with specified size, and using specified stride), and another fillPixels() to copy from an external buffer to the instance bitmap. In the latter case the specified height, width and pixel format must match that used by the bitmap instance, although the specified stride may be any value at least as large as the minimum stride for the specified geometry. It is assumed that the external buffer is of size at least (height - 1)*stride + width * bytesPerPixel. Both fillPixels() functions return false if the copy is not possible with the specified parameters. Review URL: http://codereview.appspot.com/2837041/ git-svn-id: http://skia.googlecode.com/svn/trunk@625 2bbb7eff-a529-9590-31e7-b0007b416f81
* move SkMallocPixelRef into its own .cpp file, rather than embedding itGravatar reed@android.com2010-09-09
| | | | | | | | | | | inside SkBitmap.cpp. core_files.mk updated, but if your build does not reference that, you will need to add SkMallocPixelRef.cpp to your list git-svn-id: http://skia.googlecode.com/svn/trunk@597 2bbb7eff-a529-9590-31e7-b0007b416f81
* add abstract wrapper for platform-specific bitmap backendsGravatar reed@android.com2010-09-09
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@596 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix warning in samplerGravatar reed@android.com2009-08-24
| | | | | | | | | lock pixels when we extract alpha disabling hinting when linear-text is set git-svn-id: http://skia.googlecode.com/svn/trunk@333 2bbb7eff-a529-9590-31e7-b0007b416f81
* fixes around isOpaque and ditheringGravatar reed@android.com2009-08-22
| | | | | | | | | | | | | | - copyTo() now preserves isOpaqueness, and BitmapCopyTest tests it - bitmap shader doesn't claim to have shadespan16 if dithering is on, since its sampler doesn't auto-dither (note that gradients do auto-dither in their 16bit sampler) - blitter setup just relies on the shader to report if its 16bit sampler can be called (allowing gradients to say yes regardless of dither, but bitmaps to say no if dithering is on) git-svn-id: http://skia.googlecode.com/svn/trunk@331 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove conditional build flag for mipmapsGravatar reed@android.com2009-07-17
| | | | | | | | remove obsolete SkBitmapShader.cpp file git-svn-id: http://skia.googlecode.com/svn/trunk@271 2bbb7eff-a529-9590-31e7-b0007b416f81
* use sk_bzero instead of bzero, since it isn't always available.Gravatar reed@android.com2009-06-29
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@244 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix odd-pixel bug in mipmap downsamplers (thanks brett)Gravatar reed@android.com2009-06-08
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@204 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix break in setConfig() where we always reset the bitmapGravatar reed@android.com2009-06-02
| | | | | | | | remove use of non-standard ssize_t in SkSfntUtils.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@197 2bbb7eff-a529-9590-31e7-b0007b416f81
* Style only change to make SkBitmap to make it build with VC2005.Gravatar agl@chromium.org2009-06-01
| | | | | | | TBR=reed git-svn-id: http://skia.googlecode.com/svn/trunk@196 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix trailing-wsGravatar reed@android.com2009-05-29
| | | | | | | | initialize fFlags in bitmapprocshader git-svn-id: http://skia.googlecode.com/svn/trunk@191 2bbb7eff-a529-9590-31e7-b0007b416f81