skia: Don't use -D_FORTIFY_SOURCE=2

SkString uses a dynamic growing mechanism for storing strings.
This dynamic mechanism confuses GCC, which thinks it's operating
with a single character. This causes crashes when we use
Android's -D_FORTIFY_SOURCE=2 extensions.

Consider the following code:

  SkLanguage SkLanguage::getParent() const {
      SkASSERT(fInfo != NULL);
      const char* tag = fInfo->fTag.c_str();
      SkASSERT(tag != NULL);

      // strip off the rightmost "-.*"
      char* parentTagEnd = strrchr(tag, '-');
  [DELETED]
  }

fInfo->fTag is a SkString, which is declared as:

  class SkString {
  public:
  [DELETED]
      size_t      size() const { return (size_t) fRec->fLength; }
      const char* c_str() const { return fRec->data(); }
      char operator[](size_t n) const { return this->c_str()[n]; }
  [DELETED]
  private:
      struct Rec {
      public:
          size_t      fLength;
          int32_t     fRefCnt;
          char        fBeginningOfData;

          char* data() { return &fBeginningOfData; }
          const char* data() const { return &fBeginningOfData; }
      };
      Rec* fRec;
  [DELETED]
  };

When "fInfo->fTag.c_str();" is executed in "SkLanguage::getParent()", it
returns a pointer to fBeginningOfData, which is a single char. The compiler
believes that "tag" always points to an element of size 1. When Android's
strrchr() fortify extensions are called, we trigger an abort, because
strrchr() detects an attempt to read beyond the one character
fBeginningOfData.

Change-Id: Ibe957544b5114c14018630a8f42213bf3dd806e3

Conflicts:
	Android.mk
Skia: GPU backend enhancement for canvas2D.

Improve browser performance for canvas2D, we adopted skia-gpu backend.
Add a switch to turn on GR_STATIC_RECT_VB flag, which improve the performance.

Change-Id: I41059c745ef4ee727cfbb5471b697bbfae238015
Author: Kangyuan Shu <kangyuan.shu@intel.com>
Singed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 26567

Conflicts:
	Android.mk
Skia: Fix path to OpenGL Headers

This patch will change the path to point to the correct location
of the OpenGL Headers. The path has changed to
frameworks/native/opengl/include/.

Change-Id: Ib85e3d9e6df530f12605306eb0bad7c7b5799dfe
SkBitmap: Fix race condition under multi-thread environment.

++fPixelLockCount and --fPixelLockCount in lockPixels() and unlockPixels()
is not thread safe. Some race codidions may happened that lead to black
screen in some games.

Change-Id: I22f70467d5fcc8675ef400e5066302c89ff11162
Author: Liang Wang <liangx.wang@intel.com>
Signed-off-by: Liang Wang <liangx.wang@intel.com>
Signed-off-by: Yihua Jin <yihua.jin@intel.com>
Signed-off-by: Bing Deng <bingx.deng@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 37550
Skia: GPU backend enhancement for canvas2D.

Improve browser performance for canvas2D, we adopted skia-gpu backend.
Add a switch to turn on GR_STATIC_RECT_VB flag, which improve the performance.

Change-Id: Ia9468dae210c27b1d5549787b39c432a6693d178
Author: Kangyuan Shu <kangyuan.shu@intel.com>
Signed-off-by: Yijun Zhu <yijunx.zhu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 26567

Conflicts:
	Android.mk
[MTBF]Tombstone on com.android.browser at /system/lib/libskia.so

if given a null bitmap to encode, the function will be failed, now we check
the given picture.

Change-Id: Iea12db55165817e64339135e60a1afca6dec0979
Author: Weiwei Ji <weiweix.ji@intel.com>
Signed-off-by: Weiwei Ji <weiweix.ji@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 38891
remove SSE check at runtime if it's supported at compile-time

SSE2 is a hardware feature supported by atom-based platform.
So it's unnecessary to do runtime check. This will get 2%-3%
benefit for some SKIA-intensive workloads.

Change-Id: I48fa905b503a7060a647cd38ab55ce7e179ee926
Author: Lei Li <lei.l.li@intel.com>
Signed-off-by: Lei Li <lei.l.li@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 20472

Conflicts:
	src/opts/opts_check_SSE2.cpp
Modify skjpeg_destination_mgr to make it work with both optimized and orignial Libjpeg's SW JPEG encoders

Issue:
"dest->free_in_buffer" is always 0 when sk_empty_output_buffer is called in
orignial Libjpeg's SW JPEG encoder, but it tends not to 0 when
sk_empty_output_buffer is called after optimization, for we probably need to
flush encoded data before the buffer is 100% full. This is required for some
3rd party libraries such as Intel-IPP.

Solution:
Change the size to be copies from "skjpeg_destination_mgr::kBufferSize" to
"skjpeg_destination_mgr::kBufferSize - dest->free_in_buffer".

Change-Id: If74a8f77e2bd371eee5ee7488fccf349b713d9ac
Author: Jing Sun <jing.a.sun@intel.com>
Signed-off-by: Jing Sun <jing.a.sun@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 51639
Added check for wrong stream/buffer allocation

Description of changes: Fix prevents possible access to wrong stream
(if length=0 buffer will be NULL) during ico image decoding.

Change-Id: Ie4375079238ef9c9bd3deeb57ddf4c43045db11e
turn on SK_CPU_HAS_CONDITIONAL_INSTR for x86 platform

This is turned off by default. X86 CPU has conditional jump instructions. Thus
turn on it to get generally %5 improvement for 2D workloads

Change-Id: Ie62f5b1c93ac21abb6f7f2c98ca01498a3352f7f
Author: Lei Li <lei.l.li@intel.com>
Signed-off-by: Lei Li <lei.l.li@intel.com>
Signed-off-by: bxu10X <bxu10X@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 20471

Conflicts:
	include/core/SkPreConfig.h
tweaks for forward compatibility

Change-Id: Id9089424d82567556fc1faf6024cfe46b3de7cfe
Revert "Modify skjpeg_destination_mgr to make it work with both optimized and orignial Libjpeg's SW JPEG encoders"

This reverts commit f30ab6e6c3ae943ea92ff1368d2b4601372520f5.
Build skia test program in arm mode

The skia library is built in non-thumb mode, but several optimisations
are disabled if the test program is built in thumb mode.
The ARM version of SkFloatToFixed is not as accurate as the portable
version... presumably that is ok.

Signed-off-by: Chris Dearman <chris@mips.com>

Change-Id: Ie19c3d60b0b5a77171433962aa3e8851e5ac6ae5
Several skia tunings

* Optiming constructor of Paint object
* Special copy path for small object
* Global Language list instead of constructing a new obj everytime.

Change-Id: Ic2ed4488a94e57d7192028ec4c608989837d756e
skia: Use -fno-strict-aliasing for tests

Tests aren't compatible with strict aliasing rules, and aren't
speed relevant anyway -- use -fno-strict-aliasing

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
skia: Fix build in ISO C++11 mode

Fix macro constructs that could be mistaken for new string literals

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
skia: Use -fno-strict-aliasing for now

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

Conflicts:
	Android.mk

Conflicts:
	Android.mk

Conflicts:
	Android.mk
skia: Use -fno-strict-aliasing for now

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

Conflicts:
	Android.mk

Conflicts:
	Android.mk
skia/bench: Use -fno-strict-aliasing

Use -fno-strict-aliasing for the benchmark so we don't have to use
it globally

Change-Id: Ibe5b80587818058cbb4290fe694c0b5d4cdc75a0
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Modified for migrating Skia test to lava_test_shell

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>