125 Commits

Author SHA1 Message Date
Chris Craik
59744b79ec Add hack for custom re-rasterization buckets
bug:14083128

Moves all of the font transform management into
OpenGLRenderer::findBestFontTransform(), and now simply passes down
final rasterization transforms into the FontRenderer.

Change-Id: Ie02752e6af863347b142367c7d628db5f9fc2998
2014-07-07 19:14:55 +00:00
Derek Sollenberger
c33fb2b5c0 Merge "Pass the radius as a float deeper into HWUI allowing RS to generate more accurate blurs." 2014-05-23 15:51:20 +00:00
Leon Scroggins III
d1ad5e62fd Inspect SkShader to determine hw shader.
Instead of duplicating internal info about SkShader, inspect the
SkShader installed on the SkPaint.

core/java/android/view/GLES20Canvas.java:
Remove setupModifiers, nResetModifiers, and nSetupShader.

core/jni/android/graphics/Shader.cpp:
Remove calls to create/destroy the (previously) attached SkiaShader.

core/jni/android_view_GLES20Canvas.cpp:
Remove native code for setupShader and resetModifiers.

graphics/java/android/graphics/BitmapShader.java:
graphics/java/android/graphics/ComposeShader.java:
graphics/java/android/graphics/LinearGradient.java:
graphics/java/android/graphics/RadialGradient.java:
graphics/java/android/graphics/Shader.java:
graphics/java/android/graphics/SweepGradient.java:
Remove code keeping track of native SkiaShader.

libs/hwui/Caches.h:
Include Extensions.h.

libs/hwui/DeferredDisplayList.cpp:
Compare shaders on the paint, instead of on DrawModifiers.

libs/hwui/DisplayList.cpp:
libs/hwui/DisplayList.h:
Remove vector of SkiaShaders.

libs/hwui/DisplayListOp.h:
Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

libs/hwui/DisplayListRenderer.cpp:
libs/hwui/DisplayListRenderer.h:
Remove resetShader, setupShader, refShader, and mShaderMap.

libs/hwui/FontRenderer.cpp:
Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

libs/hwui/OpenGLRenderer.cpp:
libs/hwui/OpenGLRenderer.h:
Add LayerShader, a class inheriting from SkShader, to mimic the
behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on
the SkPaint so it can be inspected later.
Set a LayerShader instead of a SkiaLayerShader.
setupDrawShader and setupDrawShaderUniforms now inspect an SkShader
passed in.
Inspect SkShader instead of mDrawModifiers.mShader.
Remove resetShader and setupShader.
setupDrawColorUniforms now takes a boolean indicating whether there is
a shader.
Add an inline function for accessing the SkShader on an SkPaint.
In setupDrawBlending(Layer*, bool), do not check the shader (which will
never be set), but do check whether the color filter may change the
alpha (newly fixed behavior).
In setupDrawBlending(SkPaint, ...), check the SkShader and whether the
color filter affects alpha (the latter is new behavior).

libs/hwui/Renderer.h:
Remove pure virtual functions setupShader and resetShader.

libs/hwui/ResourceCache.cpp:
libs/hwui/ResourceCache.h:
Remove functions for refing/unrefing shaders.

libs/hwui/SkiaShader.cpp:
libs/hwui/SkiaShader.h:
Much of this code was redundant and has been removed.
Convert structs into class with nothing but static functions for
calling describe/setupProgram.

libs/hwui/TextureCache.cpp:
libs/hwui/TextureCache.h:
Use the SkPixelRef as the key to the bitmap Lru cache, since shader
inspection will provide a different SkBitmap pointer (though it will
hold the correct SkPixelRef with the correct generation ID).

tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java:
tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java:
Update manual test to have more shaders: radial, sweep, compose,
invalid compose.

BUG:10650594

Change-Id: Iaa7189178bda1c55f96da044d2a9fa602ba36034
2014-05-22 14:46:59 -04:00
Derek Sollenberger
e392c81f6b Pass the radius as a float deeper into HWUI allowing RS to generate more accurate blurs.
Also, when converting radius to an integer value snap to the appropriate integer boundaries.

bug: 10650594
Change-Id: Icca4bc17d88162bbcbc6035d4f81bd1d98a4de2d
2014-05-21 13:27:10 -04:00
Chris Craik
81997fef18 am 3cb74d21: am 5d8343b8: am a85db5ab: Merge "libhwui: Handle the blurImage() implement once RS::init fail"
* commit '3cb74d21b2ac2427e805f72a113e8d7a2cc460f3':
  libhwui: Handle the blurImage() implement once RS::init fail
2014-05-05 21:53:56 +00:00
Lu, Shenghua
ea42e01527 libhwui: Handle the blurImage() implement once RS::init fail
Once the RS::init failed, go through the original single thread path,
this will avoid blocking the main thread(ANR), but we also should have
some implement in RenderScript component.

Change-Id: I3a21395ffd5bc144c15254893f425b1dd2643ba4
Signed-off-by: Shenghua Lu <shenghua.lu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
2014-04-25 16:11:13 +08:00
ztenghui
63d41abb40 Use pre-computed index to draw the shadow.
Also draw the umbra part as triangle fans instead of zig zag fashion.

b/12840179

Change-Id: Iaa5d15e77351acdd71f076bd8f9bb2d4d2b92faf
2014-02-25 14:18:25 -08:00
Derek Sollenberger
76d3a1b8d0 Removing SkiaColorFilter and inspecting the native object directly.
bug: 10650594
Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
2014-02-07 17:06:14 -05:00
Chris Craik
d218a92c0a Use const where possible for drawing parameters
They should never be modified by a Renderer, only read and copied.

Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
2014-01-03 13:55:08 -08:00
Tim Murray
804ff38bff Handle user-defined cache path for RS.
Change-Id: I92e3346dca331ae6a9dfbe4f95292bc604dfd196
2013-12-18 17:04:04 -08:00
Tim Murray
abe55e9224 Handle user-defined cache path for RS.
Change-Id: I92e3346dca331ae6a9dfbe4f95292bc604dfd196
2013-12-13 12:58:07 -08:00
Chris Craik
4063a0e03b Clean up modelView matrix logic
bug:11359533

Also changes shader matrix to correctly account for modelView and
currentTransform()

Change-Id: I6ce18857dc6d08ea08ca7535385c2ad351ec3caa
2013-11-18 12:51:08 -08:00
Victoria Lease
9e233b54b6 am ab99b39d: am ddc0a63d: Merge "fix emoji clipping in hw draw path" into klp-dev
* commit 'ab99b39d7d152de35ea02a364190ff325da4015b':
  fix emoji clipping in hw draw path
2013-09-20 11:20:06 -07:00
Victoria Lease
16c84069a4 fix emoji clipping in hw draw path
I guess we don't want to overwrite the last line in every RGBA glyph
with our one-line texture atlas spacer?

Bug: 10841207
Change-Id: Ief85ca58650c731e9d21dbf90942b7b44670abcc
2013-09-19 15:38:21 -07:00
Tim Murray
efb6beb438 am 19c727bb: am 895a4375: Merge "Fix FontRenderer bug." into klp-dev
* commit '19c727bbc6371924bfd2f85e804b5b6b093a8413':
  Fix FontRenderer bug.
2013-09-10 14:03:39 -07:00
Tim Murray
7a454ba5fe Fix FontRenderer bug.
bug 10691313

Change-Id: Icd5341a3c2066e337911f040ddc935c48c8d7cd1
2013-09-10 13:46:49 -07:00
Tim Murray
86ebf2876d am 9163b1d9: am 23ae1461: Merge "Add flags word to initialization." into klp-dev
* commit '9163b1d9ceeca3e956218dda1ca19a748dc48d8d':
  Add flags word to initialization.
2013-09-09 16:58:12 -07:00
Tim Murray
9578e64240 Add flags word to initialization.
bug 10427951

Change-Id: I1356b9b96315ead44aa3898de5604d75f9bb8be5
2013-09-09 16:23:27 -07:00
Tim Murray
ede1deaa88 am 816f3058: am cf8e6778: Merge "Handle updates to C++ API." into klp-dev
* commit '816f3058bdd7b888965022888e4a789ea967f444':
  Handle updates to C++ API.
2013-08-20 11:34:04 -07:00
Tim Murray
d8c8aaa82e Handle updates to C++ API.
Change-Id: I8ab17cbae3a9a4cc3c3202b8277d49f27bdf1fec
2013-08-19 12:07:52 -07:00
Romain Guy
3380cfdc77 Replace float arrays with readable names
Change-Id: I32a8be560b60a4ac5cbee2fec4574b2c5df9f825
2013-08-15 17:00:10 -07:00
Victoria Lease
723b2feb92 fix kBW_Format glyphs
Oops! kBW_Format was omitted from a couple of switch statements,
resulting in glyphs in that format being invisible.

Bug: 10206452
Change-Id: Ib2aa52250aeeecc0de1b1b78e3d0f568f368c73e
2013-08-12 15:12:49 -07:00
Tim Murray
250b1cfc83 Handle updates to RS C++ API.
Change-Id: I73127fc7369643b94d4a49f31a516b50c74b54ac
2013-08-02 15:31:29 -07:00
Victoria Lease
1e546815bb Support RGBA fonts and bitmap fonts (and RGBA bitmap fonts)
Quite a few things going on in this commit:

- Enable bitmap strikes by default in Paint objects.

The SkPaint parameter that enables bitmap strikes was not previously
included in DEFAULT_PAINT_FLAGS. This effectively disabled bitmap
fonts. Oops! It's for the best, though, as additional work was needed
in Skia to make bitmap fonts work anyway.

- Complain if TEXTURE_BORDER_SIZE is not 1.

Our glyph cache code does not currently handle any value other than 1
here, including zero. I've added a little C preprocessor check to
prevent future engineers (including especially future-me) from
thinking that they can change this value without updating the related
code.

- Add GL_RGBA support to hwui's FontRenderer and friends

This also happened to involve some refactoring for convenience and
cleanliness.

Bug: 9577689
Change-Id: I0abd1e5a0d6623106247fb6421787e2c2f2ea19c
2013-07-31 15:50:47 -07:00
Romain Guy
31e08e953f Share Caches' index buffer with FontRenderer
This reduces state changes when we draw 9patches and text together,
which happens *a lot*. Also disable the NV profiling extension by
default since it doesn't play nice with display lists deferrals.
To enable it set debug.hwui.nv_profiling to true.

Change-Id: I518b44b7d294e5def10c78911ceb9f01ae401609
2013-06-18 15:53:53 -07:00
Romain Guy
8aa195d708 Introduce Caches::bindTexture() to reduce glBindTexture calls
Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
2013-06-04 18:58:36 -07:00
Chris Craik
55709fc1c7 am 55b883b0: am 30c990c3: Merge "Draw Operation merging" into jb-mr2-dev
* commit '55b883b0a960b37aa453253f3ccb614dd95c221c':
  Draw Operation merging
2013-04-15 14:34:35 -07:00
Chris Craik
527a3aace1 Draw Operation merging
Merge simple bitmap draw operations and text operations to avoid
issuing individual gl draws for each operation. Merging other ops to
be done eventually.

The methods are different - the bitmap merging generates a single
mesh for reused, unclipped images (esp. repeated images in a listview)

The text approach queries just defers the normal font rendering until
the last drawText in the sequence that can share the same shader.

Patches are sorted and merged, but don't yet have a multiDraw
implementation. For now, the pretending-to-merge gives better sorting
behavior by keeping similar patches together.

Change-Id: Ic300cdab0a53814cf7b09c58bf54b1bf0f58ccd6
2013-04-15 13:53:02 -07:00
Romain Guy
e48da96ab5 resolved conflicts for merge of 886e1204 to master
Change-Id: Id002d2ae799c6946672335f122ecbfa07d9c0bc1
2013-04-12 11:00:21 -07:00
Romain Guy
cf51a41998 Introduce PixelBuffer API to enable PBOs
PBOs (Pixel Buffer Objects) can be used on OpenGL ES 3.0 to perform
asynchronous texture uploads to free up the CPU. This change does not
enable the use of PBOs unless a specific property is set (Adreno drivers
have issues with PBOs at the moment, Mali drivers work just fine.)

This change also cleans up Font/FontRenderer a little bit and improves
performance of drop shadows generations by using memcpy() instead of
a manual byte-by-byte copy.

On GL ES 2.0 devices, or when PBOs are disabled, a PixelBuffer instance
behaves like a simple byte array. The extra APIs introduced for PBOs
(map/unmap and bind/unbind) are pretty much no-ops for CPU pixel
buffers and won't introduce any significant overhead.

This change also fixes a bug with text drop shadows: if the drop
shadow is larger than the max texture size, the renderer would leave
the GL context in a bad state and generate 0x501 errors. This change
simply skips drop shadows if they are too large.

Change-Id: I2700aadb0c6093431dc5dee3d587d689190c4e23
2013-04-11 14:07:34 -07:00
Romain Guy
f7648b7f24 am 21af446c: am a151ef8c: Merge "First OpenGL ES 3.0 based optimization" into jb-mr2-dev
* commit '21af446ce9704bdc465bf15755148c5de50ea019':
  First OpenGL ES 3.0 based optimization
2013-04-04 16:01:59 -07:00
Romain Guy
0908764b2b First OpenGL ES 3.0 based optimization
This change uses a new OpenGL ES 3.0 feature to upload less data when
the font cache needs to be update. This can result in significant
performance improvements on device with large textures or with locales
that use a lot of glyphs (CJK for instance.)

This change also fixes various unpack alignment issues. The unpack
alignment, as well as the unpack row length, is not texture specific
but a global state that affect all glTex/SubImage2D calls. Some of
them were missing the appropriate glPixelStorei() call. This could
result in corrupted textures.

Change-Id: Iefb429d4d0d0b4e0faeadf27daafee6d30a21d85
2013-04-04 12:27:54 -07:00
Dan Morrill
e4d9a01bfc Phase 1 of refactoring SystemServer.
SystemServer is currently a monolithic class that brings up key system
services. This change is the first phase of refactoring it to be more
configurable. Specifically, it adds a set of on/off switches used to control
startup of individual services. Future plans include finer grained controls
and a more explicit and consistent startup sequence for these services.

Change-Id: I7299f5ce7d7b74a34eb56dffb788366fbc058532
2013-04-04 09:49:22 -07:00
Romain Guy
257ae3502c Optimize text GL setup
Only performs the GL setup steps when at least one glyph is drawn.
This change also skips various draw operations when the specified
paint draws with alpha = 0.

Change-Id: I9eda148b0503acffc552ee19196f5d52e958a1a2
2013-03-20 16:35:05 -07:00
Romain Guy
661a87ec28 Reduce number of glDraw calls when drawing text
This change moves the mesh buffer from FontRenderer to CacheTexture
to help reduce the number of texture binds and glDraw calls when
drawing text that spans across multiple textures.

Change-Id: I7de574d88313ca3672879ca878c253ff5f131fc1
2013-03-19 17:24:13 -07:00
Romain Guy
115096f50a Minimize texture binds when drawing text
When several CacheTextures are used to draw text, sort the
draw batches by texture ID to minimize state changes in the
driver.

This change also tweaks the font cache size and renames
a property that was too long to be set using setprop.

Change-Id: I0a36dfffe58c9e75dd7384592d3343c192d042b1
2013-03-19 11:32:41 -07:00
Romain Guy
6e20040893 Move blur code from FontRenderer to utils/Blur.cpp
Change-Id: I2cebbfbcb722ed4b37e54ffbf8b53bb92ad0c964
2013-03-08 11:28:22 -08:00
Romain Guy
0b58a3deab Make glyph copies a little more cache friendly
Change-Id: Ie21b7079cc5d3ea67a03597c57842636e4afe143
2013-03-05 12:16:27 -08:00
Romain Guy
a4adcf0239 Support 3D rotations when drawing text
If a perspective transform is set on the Canvas, drawText() should
not attempt to rasterize glyphs in screen space. This change uses
the old behavior instead (i.e. rasterize the glyphs at the native
font size and apply the transform on the resulting mesh.)

This change also adds an optimization: empty glyphs (spaces) do
not generate vertices anymore. This saves a lot of vertices in text
heavy applications such as Gmail.

Change-Id: Ib531384163f5165b5785501612a7b1474f3ff599
2013-02-28 16:04:48 -08:00
Chris Craik
dd8697c095 Avoid double blur
bug:8204062

Avoids incorrectly blurring with RenderScript after a C++ blur

Additionally, avoids draw/blurring if the input text has empty bounds

Change-Id: Ibbaf74800fff7a6e4cda3aa24286b90e7aef589d
2013-02-22 16:16:16 -08:00
Ben Cheng
08d160a366 am 7a60c43d: Merge "Use free for memory chunks allocated through memalign."
* commit '7a60c43d874bd047ea4b93b94c9b8771ea5739cc':
  Use free for memory chunks allocated through memalign.
2013-02-20 14:39:35 -08:00
Ben Cheng
15641a6181 Use free for memory chunks allocated through memalign.
BUG: 8234423
Change-Id: Ic4100a780908c94540722cc4af5f73f4940431b4
2013-02-20 13:20:03 -08:00
Chris Craik
0229d0818c am 805a6fe7: Merge "Revert "Revert "Use RenderScript for large text blurs"""
# Via Android (Google) Code Review (1) and Chris Craik (1)
* commit '805a6fe7b1417640ccaf7914171cb65515b6ab39':
  Revert "Revert "Use RenderScript for large text blurs""
2013-02-13 16:45:46 -08:00
Chris Craik
f2d8ccc15d Revert "Revert "Use RenderScript for large text blurs""
This reverts commit bf5703e52e3304246cbf0e73f6976f7d7312d238.

Change-Id: Ic6f991277dec9e80a6fed93db91499726b30ab2a
2013-02-13 16:40:02 -08:00
Chris Craik
bf5703e52e Revert "Use RenderScript for large text blurs"
This reverts commit 3f76e65d251ead65fe8ff98e3bd4c7623fbaac07

Change-Id: Ia81cd485e5ca696bb284c419dc8a1d2f3247100e
2013-02-13 19:47:24 +00:00
Chris Craik
7c1a49f5f5 Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE
This reverts commit 6c0307dd0aefe9a08794b155fc03ee60ebd14f25, reversing
changes made to a2cd828b749c444d55c2c41c7dbb85088ff94b9f.

Conflicts:
	packages/SystemUI/res/values-sv/strings.xml

Change-Id: Ia178efe8b14751583d47b2826bfe3d3d5463dd2e
2013-02-13 10:50:20 -08:00
Chris Craik
3f76e65d25 Use RenderScript for large text blurs
Still fall back to simple path for small tasks

Change-Id: I492f1b3f7d6fec1738f3e45cbfb15864bd23a392
2013-02-12 17:45:28 -08:00
Derek Sollenberger
23e500d168 Merge "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" 2013-02-06 12:57:38 +00:00
Romain Guy
b969a0de65 Add support for non-antialiased text
Change-Id: I17c073955ab94abc9b409e5fcfbc675faa07c5ba
2013-02-05 14:44:43 -08:00
Romain Guy
19d4f1806a resolved conflicts for merge of c88c60be to master-chromium
Change-Id: I3b4b42443312068e942aa779dfdc928afa7569fd
2013-01-08 17:38:15 -08:00